How to analyze permgen space

Almost every JVM nowadays uses separate region of memory, called Permanent Generation (or PermGen for short), to hold internal representations of java classes.

The root cause of java.lang.OutOfMemoryError: PermGen space is exactly the same: JVM needs to load the definition of new class but there is not enough space in PermGen for it – there are already too many classes over there.

Well there is no proper way of analyzing the permgen dump. We can get little info using JMAP tool of JDK.

Run this command :

jmap -permstats PID

where PID is the process of ID of the application. You can get it by running jcmd command.

It will list down all the classloaders in the JVM. It will tell how many classes were loaded by each, how much memory did they consume, are they alive or dead

 

In the end it will show the total sum for all the classloaders

Using this info you can try to find if any classloader is causing permgen memory leak

Uday Ogra

Connect with me at http://facebook.com/tendulkarogra and lets have some healthy discussion :)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *