Java Tools Tutorials - Herong's Tutorial Examples - Version 6.10, by Dr. Herong Yang
jhat - Java Heap Analysis Tool
This section describes the Java heap analysis tool 'jhat' command and its options. 'jhat' can be used browse a Java heap dump file through a Web interface.
Warning: "jhat" has been discontinued since JDK 9. But if you still have JDK 1.8 installed, you can continue to use it to browser heap dump files generated by JDK 9 and JDK 10.
What Is "jhat"? "jhat" is a Java heap analysis tool or heap dump file browser: Parses a Java heap dump file and launches a Web server. "jhat" enables you to browse heap dump files using your favorite webbrowser. "jhat" supports pre-designed queries (such as 'show all instances of a known class "Foo"') as well as OQL (Object Query Language) - a SQL-like query language to query heap dumps. Help on OQL is available from the OQL help page shown by "jhat". With the default port, OQL help is available at http://localhost:7000/oqlhelp/
But the "jmap" tool included in the Windows version of JDK only supports functions to print histogram of Java object heap and generate a heap dump of a given JVM process:
C:\herong>\Progra~1\java\jdk1.8.0\bin\jhat -help Usage: jhat [-stack <bool>] [-refs <bool>] [-port <port>] [-baseline <file>] [-debug <int>] [-version] [-h|-help] <file> -stack false Turn off tracking object allocation call stack. -refs false Turn off tracking of references to objects -port <port> Set the port for the HTTP server. Default is 7000. -exclude <file> Specify a file that lists data members that should be excluded from the reachableFrom query. -baseline <file> Specify a baseline object dump. Objects in both heap dumps with the same ID and same class will be marked as not being "new". -debug <int> Set debug level. 0: No debug output 1: Debug hprof file parsing 2: Debug hprof file parsing, no server -version Report version number -h|-help Print this help and exit <file> The file to read For a dump file that contains multiple heap dumps, you may specify which dump in the file by appending "#<number>" to the file name, i.e. "foo.hprof#3". All boolean options default to "true"
Last update: 2018.
Table of Contents