当JVM崩溃时,Sun JDK能否生成核心/堆转储文件? [英] Can Sun JDK generate core/heap dump files when JVM crashes?

查看:258
本文介绍了当JVM崩溃时,Sun JDK能否生成核心/堆转储文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当JVM崩溃时,有没有生成核心/堆转储文件?由于这些文件通常非常有助于找出代码中的错误。任何帮助表示赞赏。

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

推荐答案

使用以下JVM选项:

-XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath="/tmp"

JVM会将堆内容转储到指定目录中的文件。请注意,只有在抛出 OutOfMemoryError 时才会发生这种情况,因为如果由于不同原因导致JVM崩溃,则不需要转储。

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.

编辑:使用-XX打开布尔选项:+并使用-XX关闭: - 。 docs

这篇关于当JVM崩溃时,Sun JDK能否生成核心/堆转储文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆