Klocwork Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

KW运行中报java.lang.OutOfMemoryError: Java heap space问题,从log中可以看到在执行/home/docker/klocwork/bin/kwinspect的时候出现内存溢出的问题。

klocwork version:2018.3版本

working directory: "/home/jenkins/klocwork_script"
executing: "/home/docker/klocwork/bin/kwinspect" "--lang" "en" "--table-dir" "/home/jenkins/kwtables_XXX" "--report-directory" "/home/jenkins/kwtables_XXX/reports" "--metrics-config" "/home/jenkins/kwtables_XXX/build_time_data/configs/metrics_default.mconf" "--errors-config" "/home/jenkins/kwtables_XXX/build_time_data/configs/analysis_profile.pconf"
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.lang.reflect.Array.newArray(Native Method)
        at java.lang.reflect.Array.newInstance(Array.java:75)
        at com.klocwork.tfrl.AbstractLightweightTable.initDataStorage(AbstractLightweightTable.java:92)
        at com.klocwork.tfrl.AbstractLightweightTable.ensureCapacity(AbstractLightweightTable.java:84)
        at com.klocwork.tfrl.AbstractLightweightTable.addRecord(AbstractLightweightTable.java:72)
        at com.klocwork.tfrl.AbstractLightweightTable.(AbstractLightweightTable.java:50)
        at com.klocwork.tfrl.entity.LWEntityTable.(LWEntityTable.java:26)
        at com.klocwork.tfrl.entity.LWEntityTable.(LWEntityTable.java:30)
        at com.klocwork.gatekeeper.dbuilder.DBuilderEntityHashed.prepareData(DBuilderEntityHashed.java:111)
        at com.klocwork.gatekeeper.TableProcessor.loadTables(TableProcessor.java:112)
        at com.klocwork.gatekeeper.GateKeeperDriver.createProblems(GateKeeperDriver.java:49)
        at com.klocwork.inspect.InspectMain.run(InspectMain.java:119)
        at com.klocwork.inspect.InspectMain.main(InspectMain.java:140)
October 11, 2019 12:14:14 PM UTC: Report generation stage failed
Error occurred during build: Reports generation stage failed. Program exited with 1


Build errors summary:

解决方法:

找到 klocwork的安装目录,然后打开 klocwork/config/java_wrappers_memory.conf,把kwinspect=1G改为 kwinspect=4G。重新运行klocwork,问题解决。

各个组件建议内存调整(提单给klocwork后提供的,当然执行机性能本身就要好点):

kwcheck=4G

kwciagent=4G

kwjava=4G

kwadmin=4G

kwloaddb=6G

kwbuildproject=4G

kwpropagate=4G

kwmigrate=4G

kwinspect=4G

kwxsync=4G

参考链接:https://developer.klocwork.com/community/forums/klocwork-general/general-discussion/exception-thread-main-javalangoutofmemoryerror- 

你可能感兴趣的:(klocwork)