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:
How to get complete heap dump of process with other GC algorithms like CMS ?
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.