5

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.

2 Answers 2

10

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.

1
  • 1
    permstat option is now available on Windows. java version "1.6.0_31" Java(TM) SE Runtime Environment (build 1.6.0_31-b05) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
    – Sydney
    Apr 10, 2012 at 9:18
-1

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

1
  • 2
    Could you point any profiler that have an option to explore perm gen space. From what I learn, most of them only explore the heap, not the perm gen space. May 27, 2011 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.