Thursday, April 26, 2012

Handy Jmap command options

Heap Space

jmap -heap pid
- To get Heap details. Here look at the section named - "PS Old generation" -  if its above 90% then fire the next two commands in that order

jmap -histo pid
For each Java class, number of objects, memory size in bytes, and fully qualified class names are printed. VM internal class names are printed with '*' prefix. This helps to find who is occupying the heap.
If If the live suboption is specified, only live objects are counted
Note - jmap –histo:live triggers a FULL GC as compared to jmap -histo

jmap -dump:live,format=b,file=file name pid
jmap -dump:format=b,file=file name pid

The dump can be equal to the size of the heap set. For e.g. 3 GB hence ensure that much disk space is available.  One of the ways to view the dump is using a IBM heap dump analyzer which shows top leak suspects. Its been observed that the memory required to open the dump is usually at least twice as the size of the dump.

Permanent Generation Space

jmap –permstat pid

No comments:

Post a Comment