Database Reference
In-Depth Information
eben@morpheus:~$ jmap -dump:live,format=b,file=/home/eben/jmapdump.bin 4427
Dumping heap to /home/eben/jmapdump.bin ...
Heap dump file created
Now that we have captured our heap data, let's use JHAT to check it out. To run JHAT, open a
terminal and type something like the following, replacing my heap dump file location with yours:
$jhat /home/eben/jmapdump.bin
This command will run for a moment and then output something like the following:
Chasing references, expect 63 dots..............................................
.................
Eliminating duplicate references................................................
...............
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.
Now that the server is started, you can open a browser to http://localhost:7000 to view the
file. The heap dump file is also portable, so you can move it to another box after you generate it
and view it there in JHAT.
NOTE
JHAT will run for a moment and then launch a web server (there's a small HTTP server built into the
JDK since version 6) on port 7000, so you might need to close JConsole or some other program to en-
sure that port can be used, because it's not configurable. To make sure it's open, type >netstat -o -a
on Windows or >netstat -o -a | less on Linux.
For more information on how to use JHAT, consult http://java.sun.com/javase/6/docs/technotes/tools/
share/jhat.html or just type jhat -h for help options.
The generated website offers a variety of options, including limiting your view to only:
▪ All classes, including Java platform classes
▪ All classes, excluding Java platform classes
▪ All members of the rootset
▪ Instance counts for all classes
▪ Heap histogram, showing all classes with the number of instances that have been created and
their total size
▪ Classes awaiting finalizer execution
Search WWH ::




Custom Search