Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to analyze PermGen contents?

Tags:

I want to get a dump of the PermGen to see why it is filling. Is there a way to analyze this? I already know about the common suspects like log4j, tomcat webapp reloading etc, but I have some custom proxy generation code in my application, too, and just want to look under the hood.

Is this possible somehow?

like image 937
Daniel Avatar asked May 16 '10 07:05

Daniel


People also ask

What is the PermGen section in memory?

PermGen (Permanent Generation) is a special heap space separated from the main memory heap. The JVM keeps track of loaded class metadata in the PermGen. Additionally, the JVM stores all the static content in this memory section.

Is PermGen and method area same?

Method Area is a part of space in the PermGen and it is used to store the class structure and the code for methods and constructors. The biggest disadvantage of PermGen is that it contains a limited size which leads to an OutOfMemoryError.

What goes in PermGen?

The PermGen space contains the internal representation of the Java classes that JVM holds. The Permanent Generation is the garbage data that is collected in the same way as heap's other parts collected. It is a special area of memory that contains meta-data of the program's classes and the program's objects.


1 Answers

The PermGen normally consists of the string literal pool and loaded classes. To answer part of your problem, i.e. the string literal pool I wrote a utility to print a running JVM's string literal pool. It is available here:

https://github.com/puneetlakhina/javautils/blob/master/src/com/blogspot/sahyog/PrintStringTable.java

It is based on PermStat, which is the class used to print permgen stats by the jmap tool.

like image 169
Puneet Avatar answered Dec 13 '22 11:12

Puneet