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.
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,
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
See my blog post about thr permsize of Eclipse
In short the Memory Analyzer can doit, but you need the SAP JVM.
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...
This developerworks article about JVM memory has some tips on debugging heap and native memory issues.
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.