Sonar java.lang.OutOfMemoryError:PermGen空间 [英] Sonar java.lang.OutOfMemoryError: PermGen space

查看:500
本文介绍了Sonar java.lang.OutOfMemoryError:PermGen空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ant中运行构建时出现以下错误

I'm getting the following error when running a build in ant

buildcallbacks.xml:39: org.sonar.runner.RunnerException: java.lang.OutOfMemoryError: PermGen space

这是构建声纳运行的部分我们的代码。

It's the part of the build where sonar runs over our code.

有没有办法让我知道这个错误的确切来源,即是声纳服务器还是客户端等?

Is there a way for me to know exactly where this error is coming from i.e is it the sonar server or the client etc ?

这是我的buildcallbanks.xml的第39行

Here is line 39 of my buildcallbanks.xml

<sonar:sonar />

编辑:我试过从Sonar中的wrapper.conf增加permsize,我仍然得到同样的问题,无论我设置多高。我还得错过什么?

I've tried increasing the permsize from the wrapper.conf within Sonar and I still get the same issue no matter how high I set it. I must still be missing something?

推荐答案

我实际上回过头来看看你之后 - 它仍然失败了。
你几乎就在那里,但我发现了两件事:

I actually went back to look at this after you - it was still failing. You were nearly there but I found two things:


  1. 您使用的是JAVA_OPTS而不是ANT_OPTS

  2. 只有在使用UseConcMarkSweepGC时才使用CMSClassUnloadingEnabled。请参阅此处: CMSPermGenSweepingEnabled vs CMSClassUnloadingEnabled

  1. You had used JAVA_OPTS instead of ANT_OPTS
  2. CMSClassUnloadingEnabled is only used if you also use UseConcMarkSweepGC. See here: CMSPermGenSweepingEnabled vs CMSClassUnloadingEnabled

所以现在似乎有效的设置是:

So the settings that seem to be working a treat now are:

ANT_OPTS="-Xmx1024m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512m"

更新:
多年后,我再次重新访问了此问题,因为问题再次发生。您实际上不需要弄乱GC设置,只需要内存。正确使用的选项实际上是:

UPDATE: Years later I have actually re-visited this again as the problem reoccurred. You don't actually need to mess with the GC settings, just the memory. The correct options to use are in fact:

ANT_OPTS="-Xmx2G -XX:MaxPermSize=1G"

显然,您可以调整内存值以适合您的机器。

Obviously you can tweak the memory values to suit your machine.

希望这有助于其他人。

这篇关于Sonar java.lang.OutOfMemoryError:PermGen空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆