PermGen errors in Jenkins PermGen errors in Jenkins jenkins jenkins

PermGen errors in Jenkins


The one setting that really matters for PermGen space errors is (and it must be this exactly):

-XX:MaxPermSize=512m

One dash, two Big Xs, Big-M, Big-P, Big-S, no-spaces, size-in-megs, lower case m. If you screw it up it will be ignored. 99% of all the PermGen fixes I see that "don't work" are because someone didn't follow instructions precisely and used a Big-M for megabytes instead of a little-m, or put two dashes in front instead of one for example.

Also, 512 megs is just a starting point... adjust to fit your system.


I once experienced similar errors: jenkins was executing maven builds, which included surefire tests execution. I discovered that the version of maven I was using (V2 something) did not pass my JVM memory options to the surefire process fork, and some tests were failing because of this. MAVEN_OPTS, JAVA_OPTS, none did work.

I ended up passing my memory options directly in the settings.xml, and the PermGen errors were gone.

Here are the options I used (the app was fairly big):

-Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize=1024m


Completely untested suggestion, but this answer suggests using -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled when starting Tomcat (albeit for an issue in a completely different context). This answer, however, suggests that CMSPermGenSweepingEnabled is unnecessary on Java 6 and that -XX:+UseConcMarkSweepGC must be used for CMSClassUnloadingEnabled to be effective.

At the very least -XX:+CMSClassUnloadingEnabled may do the trick assuming that the underlying issue is caused by classes being unnecessarily maintained in the PermGen space for your Tomcat instance.