0

I am using below command to get heap dump

jmap -dump:live,format=b,file=/tmp/heap2.bin <pid>

VM opts:

-Xms2g -Xmx4g  -XX:+UseG1GC -XX:MaxGCPauseMillis=1500 
-XX:G1HeapRegionSize=2 -XX:+PrintFlagsFinal -XX:ParallelGCThreads=4 -XX:ConcGCThreads=2 

But this command generates 300+ MB bin heap dump file for process running with 1.2 GB memory( 1.2 GB memory has been shown in RES column of top command)

EDIT: I have removed :live option after @kdgregory suggestion but heap dump is not generated due to G1GC issue ( Related SE question: Java heap dump error with jmap command : Premature EOF)

My queries:

  1. How to get complete heap dump of process with other GC algorithms like CMS ?

  2. How to get heap dump along with PermGen memory too? (permstat from command line is not useful for me).I am interested in analysis of PermGen OutOfMemory error too.

Community
  • 1
  • 1
Ravindra babu
  • 37,698
  • 11
  • 250
  • 211
  • 3
    Remove `live`; this is [in the documentation](http://docs.oracle.com/javase/7/docs/technotes/tools/share/jmap.html) – kdgregory Dec 03 '15 at 18:09
  • One good catch. But how to skip GC call? – Ravindra babu Dec 03 '15 at 18:18
  • 1
    Are you saying that it triggers GC when you omit `live`? Because doing so would rather defeat the purpose of that optional (ie, _all_ dumps would just contain live objects). – kdgregory Dec 03 '15 at 19:20
  • Even after removing live option, the dump size and process memory size are not matching. Dump is small compared to actual memory size – Ravindra babu Apr 13 '16 at 12:14
  • 1
    The memory being used by the application is much more than just what objects are on the heap at the moment. – Peter Lawrey Jul 11 '16 at 15:33
  • 1
    The problem is there is no tool for analysis non heap data. I use the `/proc/{pid}/mem` to see how the memory of the process is mapped out. – Peter Lawrey Jul 11 '16 at 15:35

0 Answers0