Can Sun JDK generate core/heap dump files when JVM crashes?

做~自己de王妃 提交于 2019-11-28 03:56:48

问题


Is there anyway to generate core/heap dump file when JVM crashes? Since these files are usually very helpful to find out bugs in code. Any help is appreciated.

cheng


回答1:


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




回答2:


You can use -XX:HeapDump JVM options.



来源:https://stackoverflow.com/questions/10944082/can-sun-jdk-generate-core-heap-dump-files-when-jvm-crashes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!