A couple of weeks ago iv stumbled upon the following post which carried the title "Good Riddance, PermGen OutOfMemoryError !", the thing is that this error happens quite alot when you are redeploying an application under JBoss for a couple of times.
The only way to recover from it is to restart JBoss which is quite annoying (especially when it takes 2min to load it up again).
Iv promised to myself to check the proposed post configuration and mailed the link to all my coworkers , obviously i forgot it totally :).
That was until one of my coworkers who read my email asked me if this thing actually works , his question had led me to perform the following test:
- Iv compared two configuration of /bin/run.conf and counted how many times ill be able to redeploy an application without getting the error.
- In the first (standard) configuration iv set JAVA_OPTS to "-Xms32m -Xmx64m -XX:MaxPermSize=64m .. " (the rest unchanged ) , this limits the memory size which is allocated to the JVM and to the perm gen memory section.
- In the second (modified) configuration iv appended "-XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled" to JAVA_OPTS.
The results were quite disappointing , no matter how iv tried to set these parameters the results were identical , in fact the only thing that made a positive effect was setting "-XX:MaxPermSize=64m" to "-XX:MaxPermSize=128m".
Frustrated a bit iv went back to the post and noticed that it was updated , a link to another post was added , this one with the more realistic title "PremGen strikes back" :).