LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jhat

Java Heap Analysis Tool — parses HPROF heap dumps and serves them over HTTP

TLDR

Analyze a heap dump (serves on http://localhost:7000)
$ jhat [dump.hprof]
copy
Use a custom HTTP port
$ jhat -port [8080] [dump.hprof]
copy
Run with more heap for the analyzer itself
$ jhat -J-Xmx8g [dump.hprof]
copy
Compare against a baseline dump
$ jhat -baseline [old.hprof] [new.hprof]
copy
Disable object reference tracking (faster, less memory)
$ jhat -stack false -refs false [dump.hprof]
copy

SYNOPSIS

jhat [options] heap-dump-file

DESCRIPTION

jhat parses a Java heap dump file in HPROF binary format and launches a small HTTP server for browsing the heap. The web UI exposes pre-built queries (instances of a class, reference chains, reachable objects, histograms) and an Object Query Language (OQL) prompt for arbitrary queries over the heap.Heap dumps can be produced by `jmap -dump`, `jcmd <pid> GC.heap_dump`, `jconsole`, or via `-XX:+HeapDumpOnOutOfMemoryError` on a crashing JVM.

PARAMETERS

-stack true|false

Track object allocation call stacks (default `true`). Disable to speed up load of large dumps.
-refs true|false
Track object references (default `true`). Disable to reduce memory use; most reference queries will be unavailable.
-port port
TCP port for the HTTP server (default 7000).
-exclude file
Path to a file listing data members to exclude from reachability queries.
-baseline file
Specify a baseline dump. Objects present in both dumps are marked "not new".
-debug int
Debug level. `0` = off, `1` = parse HPROF, `2` = parse without starting server.
-version
Print version and exit.
-Jflag
Pass flag straight to the JVM running jhat (e.g. `-J-Xmx8g`).
-help
Show help.

CAVEATS

jhat was deprecated in JDK 8 (JEP 241) and removed in JDK 9. On modern JDKs, use jcmd, jmap -histo, VisualVM, Eclipse MAT, or JProfiler instead. The HTTP server binds to all interfaces by default — use firewall rules or SSH tunneling to avoid exposing heap contents on a network.

HISTORY

jhat was introduced in Java 6 as a replacement for the older `hat` tool. It was deprecated in Java 8 and removed in Java 9 in favor of more capable third-party analyzers.

SEE ALSO

jmap(1), jstack(1), jps(1)

Copied to clipboard
Kai