java 内存不足:声纳中的java堆大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26625451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 10:15:40  来源:igfitidea点击:

Out of memory:java heap size in sonar?

javasonarqubesonar-runner

提问by user3427658

I am analysing a large project in Sonar and getting following error,

我正在分析 Sonar 中的一个大型项目并出现以下错误,

00:41:48.325 INFO  - Base dir: C:\Users\Administrator\Desktop\sonar-runner-dist-2.4\sonar-runner-2.4\bin\.
00:41:48.325 INFO  - Working dir: C:\Users\Administrator\Desktop\sonar-runner-dist-2.4\sonar-runner-2.4\bin\.\.sonar
00:41:48.325 INFO  - Source encoding: UTF-8, default locale: en_US
00:41:48.325 INFO  - Quality profile for java: PMD
00:41:48.332 INFO  - Sensor QProfileSensor...
00:41:48.336 INFO  - Sensor QProfileSensor done: 4 ms
00:41:48.336 INFO  - Sensor CpdSensor...
00:41:48.336 INFO  - SonarEngine is used for java
00:41:48.336 INFO  - Sensor CpdSensor done: 0 ms
00:41:48.336 INFO  - Sensor InitialOpenIssuesSensor...
00:41:48.486 INFO  - Sensor InitialOpenIssuesSensor done: 150 ms
00:41:48.486 INFO  - Sensor ProfileEventsSensor...
00:41:48.602 INFO  - Sensor ProfileEventsSensor done: 116 ms
00:41:48.603 INFO  - Sensor ProjectLinksSensor...
00:41:48.605 INFO  - Sensor ProjectLinksSensor done: 2 ms
00:41:48.606 INFO  - Sensor VersionEventsSensor...
00:41:48.631 INFO  - Sensor VersionEventsSensor done: 26 ms
00:41:48.631 INFO  - Sensor FileHashSensor...
00:41:48.631 INFO  - Sensor FileHashSensor done: 0 ms
00:41:48.794 INFO  - Execute decorators...
00:41:49.256 INFO  - Store results in database
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:19:23.133s
Final Memory: 11M/494M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
    at org.sonar.runner.impl.BatchLauncher.delegateExecution(BatchLauncher.java:91)
    at org.sonar.runner.impl.BatchLauncher.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOfRange(Arrays.java:2694)
    at java.lang.String.<init>(String.java:203)
    at java.lang.StringBuilder.toString(StringBuilder.java:405)
    at com.persistit.Value.get(Value.java:2143)
    at com.persistit.DefaultValueCoder$ObjectFieldAccessor.fromValue(DefaultValueCoder.java:560)
    at com.persistit.DefaultValueCoder.renderDefaultFields(DefaultValueCoder.java:1154)
    at com.persistit.DefaultValueCoder.render(DefaultValueCoder.java:1132)
    at com.persistit.DefaultValueCoder.get(DefaultValueCoder.java:1065)
    at com.persistit.Value.get(Value.java:2413)
    at com.persistit.encoding.CollectionValueCoder.render(CollectionValueCoder.java:220)
    at com.persistit.encoding.CollectionValueCoder.get(CollectionValueCoder.java:167)
    at com.persistit.Value.get(Value.java:2413)
    at com.persistit.DefaultValueCoder$ObjectFieldAccessor.fromValue(DefaultValueCoder.java:560)
    at com.persistit.DefaultValueCoder.renderDefaultFields(DefaultValueCoder.java:1154)
    at com.persistit.DefaultValueCoder.render(DefaultValueCoder.java:1132)
    at com.persistit.DefaultValueCoder.get(DefaultValueCoder.java:1065)
    at com.persistit.Value.get(Value.java:2413)
    at com.persistit.encoding.CollectionValueCoder.render(CollectionValueCoder.java:232)
    at com.persistit.encoding.CollectionValueCoder.get(CollectionValueCoder.java:167)
    at com.persistit.Value.get(Value.java:2413)
    at com.persistit.DefaultValueCoder$ObjectFieldAccessor.fromValue(DefaultValueCoder.java:560)
    at com.persistit.DefaultValueCoder.renderDefaultFields(DefaultValueCoder.java:1154)
    at com.persistit.DefaultValueCoder.render(DefaultValueCoder.java:1132)
    at com.persistit.DefaultValueCoder.get(DefaultValueCoder.java:1065)
    at com.persistit.Value.get(Value.java:2413)
    at com.persistit.Value.get(Value.java:2015)
    at org.sonar.batch.index.Cache$ValueIterator.next(Cache.java:400)
    at org.sonar.batch.index.Cache$ValueIterator.next(Cache.java:373)
    at org.sonar.core.issue.db.IssueStorage.batchInsert(IssueStorage.java:77)
    at org.sonar.core.issue.db.IssueStorage.save(IssueStorage.java:66)
    at org.sonar.batch.issue.IssuePersister.persist(IssuePersister.java:52)
    at org.sonar.batch.phases.PhaseExecutor.executePersisters(PhaseExecutor.java:163)
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

Can any one help me in finding out error,i am analysing project by setting java heap to 2048m in wrapper.conf i got out of memory heap size,so i tired to set java heap size to 5120 and sonar-runner-opts to 8192 but still its failing at same point,

任何人都可以帮助我找出错误,我正在通过在wrapper.conf中将java堆设置为2048m来分析项目我的内存堆大小不足,所以我厌倦了将java堆大小设置为5120并将sonar-runner-opts设置为8192但它仍然在同一点失败,

These are the plugins which i have used abacus,checkstyles,pmd,java,useless code tracker Database:mysql

这些是我使用过的插件,算盘,checkstyles,pmd,java,无用的代码跟踪数据库:mysql

Thanks in advance

提前致谢

回答by Muhammad Hamed

Check the answer of this question .. it will help you wither to set the memory or fixing the issue of wrong selection with file extension

检查这个问题的答案..它将帮助您设置内存或修复文件扩展名错误选择的问题

Sonar - OutOfMemoryError: Java heap space

声纳 - OutOfMemoryError:Java 堆空间

If your code is to big then you have to break it into modules .. check this

如果你的代码太大,那么你必须把它分成模块..检查这个

http://docs.codehaus.org/display/ENUNCIATE/Multi-Module+Projects

http://docs.codehaus.org/display/ENUNCIATE/Multi-Module+Projects

I hope this could help!

我希望这会有所帮助!