Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to analyse the heap dump using jmap in java

Tags:

java

jmap

I am creating heap dump using below command:

jmap -dump:file=DumpFile.txt <process-id> 

I have opened the generated file - DumpFile.txt but it is not in readable format. So please let me know how to analyze the data in the generated file.

like image 387
Chaitanya Avatar asked Feb 28 '13 08:02

Chaitanya


People also ask

How do I Analyse a Java heap dump file?

The jhat command parses a java heap dump file and launches a webserver. jhat enables you to browse heap dumps using your favorite webbrowser. Note that you should have a hprof binary format output to be able to parse it with jhat . You can use format=b option to generate the dump in this format.

What is JMAP dump?

jmap is a tool to print statistics about memory in a running JVM. We can use it for local or remote processes. To capture a heap dump using jmap, we need to use the dump option: jmap -dump:[live],format=b,file=<file-path> <pid>


1 Answers

You should use jmap -heap:format=b <process-id> without any paths. So it creates a *.bin file which you can open with jvisualvm.exe (same path as jmap). It's a great tool to open such dump files.

like image 134
yves.beutler Avatar answered Sep 23 '22 06:09

yves.beutler