Every time we make a new build, we redeploy it, and after a few such redeployments it throws this error.
And we need to restart JBOSS.
As we are seeing this error very frequently, I had googled it and found some information on this.
Here are the links to this information.
These links also say that after a few redeployments, JBOSS console shows up this error.
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:
- Restart the JBOSS every time we redeploy.
- 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.