Tomcat – java.lang.OutOfMemoryError: PermGen space

 

Tomcat production server sometime will hit the following java.lang.OutOfMemoryError: PermGen space error.

java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

You should change the “Xms” and “PermSize” value base on your server capability.

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"