views:

52

answers:

3

Hi, I have some problems with permgen overflow. What tools I can use to view what classes are now loaded into permgen and how much memory they use? Thanks.

A: 

Looks like what you search is a profiler. (for example jProfiler or for open source : http://java-source.net/open-source/profilers)

Vinze
Thanks, I can't find this option in jprofiler
alex543
+1  A: 

Java Visual VM comes with the Java 6 JDK (./bin/jvisualvm). You can do application monitoring and profiling with it.

Nik
+1  A: 

Maybe you have a large code base or are interning lots of strings.

Try jmap:

jmap -permstat <pid>

(Note: the permstat option is not available in Windows)

Example:

$ jmap -permstat 22982
Attaching to process ID 22982, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 17.0-b16
100691 intern Strings occupying 5641096 bytes.
finding class loader instances ..Finding object size using Printezis bits and skipping over...
done.
computing per loader stat ..done.
please wait.. computing liveness..done.
class_loader    classes bytes   parent_loader   alive?  type

<bootstrap>     303     1355992   null          live    <internal>
0xdd159fe8      9       94104   0xdd153c30      live    sun/misc/Launcher$AppClassLoader@0xae7fcfa0
0xdd153c30      0       0         null          live    sun/misc/Launcher$ExtClassLoader@0xae7b0178

total = 3       312     1450096     N/A         alive=3, dead=0     N/A

You can also try dumping the heap to a file and then loading it into Eclipse Memory Analyser, which will give you useful information such as a Leak Suspects Report and Dominator Tree.

jmap -dump:format=b,file=heap.bin 22982

If necessary, you can increase your PermGen space by using the -XX:MaxPermSize JVM option.

dogbane