Java, Maven and Gradle 25 · Diagnostics
Dump the heap on OutOfMemoryError
Have the JVM write a heap dump automatically when memory runs out.
java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -jar app.jar
Official Java, Maven and Gradle 25 documentation
More diagnostics commands
- List running Java processes
- Take a thread dump
- Show heap usage
- Write a heap dump
- Show the flags a JVM is using
All diagnostics commands · Java, Maven and Gradle 25 cheatsheet