Jenkins - java.lang.OutOfMemoryError: PermGen space -

。_饼干妹妹 提交于 2019-12-03 15:35:42
Arun Sangal

In my ~/.bash_profile file, I have set the following 3 variables. Note there are other variables in this file as well i.e. JAVA_HOME, ANT_HOME, SONAR_HOME, SONAR_RUNNER_HOME, etc:

export JAVA_OPTS="-XX:MaxPermSize=512m -Xms512m -Xmx1024m"
export GRADLE_OPTS="-XX:MaxPermSize=512m"
export SONAR_RUNNER_OPTS="-Xmx512m -XX:MaxPermSize=512m"

All - working now.

The first export line: will get Jenkins going without PermGen error, the 2nd line will make Gradle going when Jenkins calls Gradle script (via a another wrapper script for ex. .sh/etc), third line makes "sonar-runner" command to work fine (otherwise, I was getting an error for PermGen after "Initialize Hibernate"... line during sonar-runner command's output). You run sonar-runner command in the workspace where you have compiled java, reports related to static code analysis tools (pmd/checkstyle/findbugs) and other code coverage reports (jacoco/cobertura). Workspace should have "sonar-project.properties" file. Look for SonarQube help pages about this file and what all variables it contains for a project.

All those options are documented here: http://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html or here if you are using Java 7: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html

IF you are using Gradle, You can set the -Xmx or -XX:MaxPermSize by adding a GRADLE_OPTS global environment variable in the Jenkins global configuration. To do this, click Manage Jenkins, then Configure System. In the Global properties section, click the Environment Variables checkbox, then add a new environment variable called GRADLE_OPTS with the value set appropriately as below:

name: GRADLE_OPTS value: -Xmx1024m -XX:MaxPermSize=1024m

where 1024 is memory specified. You can change it as per your requireent.

Similar configuration is needed for Maven. Please see the link below for more details: https://wiki.jenkins-ci.org/display/JENKINS/Builds+failing+with+OutOfMemoryErrors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!