With the following JVM options:
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath="/tmp"
JVM will dump the content of heap to a file in specified directory. Note that this only happens when OutOfMemoryError
is thrown since dump isn't really needed if JVM crashed due to a different reason.
Edit: "Boolean options are turned on with -XX:+ and turned off with -XX:-." docs
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…