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

Compare with Current View Page History

« Previous Version 3 Next »

UNDER CONSTRUCTION

${renderedContent}

Quick Links to:

About this PANEL

${renderedContent}

What is a PermGen error

To understand this error, we have to look into 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.  Since 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 and removed from the permanent generation heap.

The OutOfMemoryError: PermGen Space error occurs when the permanent generation heap is full.  Although this error can occur in normal circumstances, usually, this error is caused by a memory leak.

In short, a memory leak means that a classloader and all its classes cannot be garbage collected after they have been undeployed/discarded.

  • No labels