Java, Maven and Gradle 25 · Diagnostics
Write a heap dump
Save the heap to a file to analyze memory leaks.
jcmd 12345 GC.heap_dump /tmp/heap.hprof
Caution: A heap dump can be as large as the heap and may contain sensitive data.
Official Java, Maven and Gradle 25 documentation
More diagnostics commands
- List running Java processes
- Take a thread dump
- Show heap usage
- Dump the heap on OutOfMemoryError
- Show the flags a JVM is using
All diagnostics commands · Java, Maven and Gradle 25 cheatsheet