Who has never faced to "java.lang.OutOfMemoryError: PermGen space" using JBoss Application Server and JBoss Seam Framework?
I have faced to this problem more frequently in production environment because the application has expanded considerably. I remember I had the same problem in Brazil when we were doing our final project of Post Graduate APGS at PUC University. When I got this job, the fist thing I did was change JVM settings to fix this problem in my workstation.
You are going to see in many sites and blogs people saying that increasing the PermSize will solve the problem. This way you just postpone this exception.
By default, the Collect Garbage cleans the Heap but does NOT clean the Permanent Generation.
The default value for PermSize is 64 MB which is not enough neither for development nor production environment. You definitely should not use the default configuration for professional applications involving JBoss Application Server and JBoss Seam Freamework.
The only way to really resolve this issue is enabling CG to clean the Permanent Generation space as well.
I haven't had this problem since I started using those configuration:
-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
I run JBoss in my computer inside Eclipse but if you run outside or for production environment you have to put those parameters on the file JBOSS_HOME/bin/run.conf .
# Specify options to pass to the Java VM.
if [ "x$JAVA_OPTS" = "x" ]; then
#JAVA_OPTS="-Xms1024m -Xmx1024m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
JAVA_OPTS="-Xms1024m -Xmx1024m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -XX:PermSize=192m -XX:MaxPermSize=192m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled"
I am sure you will never see PermGen space again!
Leonardo Pinho Correa
Java Analyst/Developer, soccer player and beer drinker