I am trying to take heap dump using below 2 commands
jcmd produces file size of ~300M and jmap produces file size of ~1.4G. why these are different sizes, do we have any additional information in jmap ? am I missing some arguments in jcmd ?
JDK is 1.8.0_162
Xms and Xmx is 4G
By Default (When no [options] are provided],
JMAP took an all-objects dump and JCMD took only live-objects dump.
Using JMAP command: While using this command you don't need to specify anything as it is by default produce the heap dump of all the objects. If you need live objects alone, you can pass '-dump:live' option in JMAP.
Using JCMD command: While using this command you have to pass -all option. Otherwise, it will request a full GC and generates only live objects dump.
JCMD - without any options of object state - By default it dumps only the live objects.
JMAP - without any options of object state - By default it dumps all the objects.
For more information refer here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With