1jhat(1) General Commands Manual jhat(1)
2
3
4
6 jhat - Java Heap Analysis Tool
7
9 jhat [ options ] <heap-dump-file>
10
11
12
14 options
15 Options, if used, should follow immediately after the command
16 name.
17
18 heap-dump-file
19 Java binary heap dump file to be browsed. For a dump file that
20 contains multiple heap dumps, you may specify which dump in the
21 file by appending "#<number> to the file name, i.e.
22 "foo.hprof#3".
23
24
26 The jhat command parses a java heap dump file and launches a webserver.
27 jhat enables you to browse heap dumps using your favorite webbrowser.
28 jhat supports pre-designed queries (such as 'show all instances of a
29 known class "Foo"') as well as OQL (Object Query Language) - a SQL-like
30 query language to query heap dumps. Help on OQL is available from the
31 OQL help page shown by jhat. With the default port, OQL help is avail‐
32 able at http://localhost:7000/oqlhelp/
33
34 There are several ways to generate a java heap dump:
35
36 o Use jmap(1) -dump option to obtain a heap dump at runtime;
37
38 o Use jconsole(1) option to obtain a heap dump via HotSpotDiagnos‐
39 ticMXBean @
40 http://docs.oracle.com/javase/7/docs/jre/api/management/exten‐
41 sion/com/sun/management/HotSpotDiagnosticMXBean.html at runtime;
42
43 o Heap dump will be generated when OutOfMemoryError is thrown by
44 specifying -XX:+HeapDumpOnOutOfMemoryError VM option;
45
46 o Use hprof @
47 https://docs.oracle.com/javase/7/docs/technotes/sam‐
48 ples/hprof.html.
49
50
51 NOTE: This tool is experimental and may not be available in future ver‐
52 sions of the JDK.
53
55 -stack false/true
56 Turn off tracking object allocation call stack. Note that if
57 allocation site information is not available in the heap dump,
58 you have to set this flag to false. Default is true.
59
60 -refs false/true
61 Turn off tracking of references to objects. Default is true. By
62 default, back pointers (objects pointing to a given object a.k.a
63 referrers or in-coming references) are calculated for all objects
64 in the heap.
65
66 -port port-number
67 Set the port for the jhat's HTTP server. Default is 7000.
68
69 -exclude exclude-file
70 Specify a file that lists data members that should be excluded
71 from the "reachable objects" query. For example, if the file
72 lists java.lang.String.value, then, whenever list of objects
73 reachable from a specific object "o" are calculated, reference
74 paths involving java.lang.String.value field will not considered.
75
76 -baseline baseline-dump-file
77 Specify a baseline heap dump. Objects in both heap dumps with the
78 same object ID will be marked as not being "new". Other objects
79 will be marked as "new". This is useful while comparing two dif‐
80 ferent heap dumps.
81
82 -debug int
83 Set debug level for this tool. 0 means no debug output. Set
84 higher values for more verbose modes.
85
86 -version
87 Report version number and exit.
88
89 -h Output help message and exit.
90
91 -help
92 Output help message and exit.
93
94 -J<flag>
95 Pass <flag> to the Java virtual machine on which jhat is run. For
96 example, -J-Xmx512m to use a maximum heap size of 512MB.
97
98
100 o jmap(1)
101
102 o jconsole(1)
103
104 o hprof - Heap and CPU profiling tool @
105 https://docs.oracle.com/javase/7/docs/technotes/sam‐
106 ples/hprof.html.
107
108
109 16 Mar 2012 jhat(1)