Technology weblog

IT-Essence
Friday Dec 05, 2008

Tomcat OutOfMemoryError: PermGen space

Recently, I was confronted with yet another java.lang.OutOfMemoryError: PermGen space.

java.lang.OutOfMemoryError: PermGen space
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
...

This time it was Tomcat, getting completely stuck after typically one or two days. I have a couple of applications deployed on Tomcat, and indeed, these applications are predominantly based on Hibernate and Spring.

After some research on the Internet, I readily reached the conclusion that resolving the symptoms would be much quicker and easier than trying to resolve the cause. I stopped Tomcat and exported my JAVA_OPTS on the command line like so:

export "JAVA_OPTS=-Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m"

Thereafter I restarted Tomcat. It is now running happily ever after.

Comments:

Post a Comment:
Comments are closed for this entry.

Hire us
Archives
Tags
Links
Stats
Referrers