Friday, June 6, 2014

How to use jmap and jhat

1. Using jmap to take a memory dump of process 1234, save the dump file as "heapdump".

[root]# jmap -dump:format=b,file=heapdump -F 1234
Attaching to process ID 1234, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 20.45-b01
Dumping heap to heapdump ...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Finding object size using Printezis bits and skipping over...
Heap dump file created

2.  Using jhat to analyze the file "heapdump" and start a http service.

jhat -J-Xmx256m heapdump

3. Open browser to http://<IP of the server>:7000/

"Show heap histogram"
"Show instance counts for all classes (excluding platform)"

Then we can identify the super class with most instances.

1 comment:

  1. Dear Students! We cover a multitude of academic topics, so you’ll surely get what you need. An authentic study in line with your instructions is guaranteed. Depending on the number of pages and degree of trickiness, our pros can complete your order in 3-6 hours and more.

    ReplyDelete

Popular Posts