Few days ago, I noticed that I’m occasionally seeing a java.lang.OutOfMemory: PermGen exception when my Java web site runs under Tomcat.
I read about this error online and understand why this exception occurs. I followed a tutorial to increase my MaxPermSize, and edited by catalina.sh to contain the following:
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"
However, I would like to understand more about my PermGen capabilities:
-
Can anyone tells me how I can understand my server capability in order to give the appropriate new size?
-
Moreover does anyone know how I can make memory measurements on Apache tomcat?
The PermGen is the space of the memory not managed by the Garbage Collector. It contains loaded classes, their methods, statics, strings, etc…
With a Xmx at 1536Mo, you can try to put the MaxPermSize to 384M.
If the value is to high, the JVM won’t start, so it’s easy to find the maximum size.
But the real question is why is your PermGen so full.
Do you load a lot of classes ?