Welcome Message

"The difference between a successful person and others is not a lack of strength,
not a lack of knowledge, but rather a lack in will."
-Vince Lombardi

August 20, 2009

Regarding OutOfMemoryError: PermGen space

Every time we make a new build and redeploy it in JBOSS and after a few such redeployments it throws the below error

 

java.lang.OutOfMemoryError: PermGen

 

And we need to restart JBOSS.

 

Excerpt from links:

 

In Sun JVM, garbage-collection of Java Heap is managed in generations (memory segments holding objects of different ages- Young Generation, Tenured Generation and Permanent Generation).  Garbage collection algorithms in each generation are different.

 

The permanent generation holds data needed by the virtual machine to describe objects that do not have equivalence at the Java language level. For example objects describing classes and methods are stored in the permanent generation.

Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen

We can increase the PermGen (Permanent Generation) size in JVM, but this just delays the error and cannot get rid of it.

 

To tackle this, posts suggest two options:

  1. Restart the JBOSS every time we redeploy.
  2. Change the Sun JVM to some other JVM.

 

Links also suggests JRockit JVM as it doesn’t have a PermGen area and can never throw this error.

 

I had just did some search, I don’t know if we are supposed to change the JVM or not.

But that is what I came across on the net.

 

Links for your reference…

 

These links also say that after a few redeployments, JBOSS console shows up this error.

 

http://blog.yannis-lionis.gr/?p=8

http://www.freshblurbs.com/explaining-java-lang-outofmemoryerror-permgen-space

http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html#1.1.%20Generations|outline