There may be some scenarios where you need to take java heap dumps without connecting to a profiler, or there may be chances that you want to see only live heap objects or you may be asked to find out the live java heap objects which causes application slow down/out of memory at run time. For all of these , there is a solution lies with in JAVA JDK – JMAP .
JMAP – Prints Heap memory details of the debug server
Open Terminal in the debug server
Find out the process id of the java application for which the heap dump should be taken
ps -aef | grep java
Go to bin directory of your java and give the following command
jmap -dump:live,format=b,file=<filenmae.bin> <pid>
Live option displays only live objects present at the moment.