views:

1501

answers:

6

Given a heapdump or a running VM, how do I discover what the contents of the permanent generation is ? I know about 'jmap -permstat' but that's not available on Windows.

A: 

hi there,

you can use JConsole or jvisualvm.exe(with jdk 1.6 7) to find what is where. If you want to know how all of your objects are related to each other and tree of objects, then you might want to try Eclipse Memory Analyzer -- http://www.eclipse.org/mat/.

IN summary, you will get want you want from "http://www.eclipse.org/mat/".

Good luck,

anjanb
I am looking specifically for which objects are in the permanent generation. These tools will not answer that question.
Tom
Hi Tom,MAT can answer your question but you would have to use the SAP JVM, which is unfortunately at the moment a little bit difficult to get. You would need to get NW CE from https://www.sdn.sap.com/irj/sdn/nw-ce
kohlerm
+1  A: 

The permanent generation contains the class object. So you should check the heap dump or other form of object list for classes. If you have problem with the size of permanent generation usually it is caused by two reason:

  • your program or a library you use creates classes dynamically and the default size of permanent generation is too small - simple increate the size with -XX:MaxPermSize=256m
  • your program or a library you use creates new classes dynamically every time it is called, so the size of permanent generation increases non-stop - this is a programming error you should fix it (or search a fix/create a bug report)

To see which is your case check the size of the permanent generation over a larger period.

And a good overview about permanent generation:

http://blogs.sun.com/jonthecollector/entry/presenting_the_permanent_generation

laszlot
This reply is incomplete: we currently have an app that is leaking permgen memory and the number of loaded classes is absolutely constant. Both facts can be seen by using JConsole. We suffer from the same problem as the original poster in that we have no way to analyze the permgen in detail.
Boris Terzic
A: 

See my blog post about thr permsize of Eclipse

In short the Memory Analyzer can doit, but you need the SAP JVM.

kohlerm
A: 

Do you have a specific problem to solve? The use of String.intern() is one of the typical causes for permgen problems. Additionally projects with a lot of classes also have permgen problems.

I do not know how to get into the permgen and see what it is there...

ReneS
A: 

This developerworks article about JVM memory has some tips on debugging heap and native memory issues.

Jörn Zaefferer
A: 

Permanent generation really only contains two kinds of things: Class definitions and interned strings. Latter very rarely gives you problems, but it is often blamed for problems. More often former is the one giving problems, due to code generation and partial hot reloading (dangling references).

Unlike name suggests, permgen does eventually get GC'ed too, just not part of regular GC cycle. Hence unreferenced interned Strings and unused classes do get cleaned up. But permgen also does not grow dynamically which means that it is sometimes necessary to manually resize its settings for JVM start.

StaxMan