java 1.7.45 : How to get full heap dump of process

2019-09-12 22:33发布

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.

0条回答
登录 后发表回答