You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

UNDER CONSTRUCTION

${renderedContent}

Quick Links to:

About this PANEL

${renderedContent}

What is a PermGen error

To understand this error, you have to have some understanding as to how the JVM memory is structured.

There are two memory regions in the JVM: the heap and the stack. Local variables and methods reside on the stack, everything else on the heap.

The Java heap is also structured into regions, each region is called a generation. The longer an object lives, the higher the chance it will be promoted to an older generation. Young generations are more garbage collected than older generations.  However, there is also a separate heap space called permanent generation.  The permanent generation is a separate region, it is not considered part of the Java Heap space. Objects in this space are relatively permanent.  Class definitions are stored here, as are static instances.

During normal operations, classloaders deploy and undeploy classes all the time.  For example, this happens when an application is deployed or undeployed on a webserver.  On web servers, all applications have their own Classloader.  Whenever an application is deployed or undeployed, its class definitions and Classloader are respectively put into the permanent generation heap.  Spring and Hibernate often make proxies of certain classes.  Such proxy classes are loaded by a classloader along with any generated class definitions (which are loaded like classes and stored in permanent generation heap space) and are never discarded, which causes the permanent generation heap space to fill up. and eventually result in a OutOfMemoryError: PermGen Space error.

The OutOfMemoryError: PermGen Space error occurs when the permanent generation heap is full.  This error can occur in normal circumstances (example given in the above paragraph).  However, this error can also be caused by a memory leak.  A memory leak means that a classloader and all its classes can never be garbage collected even after they have been undeployed/discarded.

  • No labels