将 HeapDumpOnOutOfMemoryError 参数用于 JBoss 的堆转储 [英] Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss
问题描述
有人告诉我,我可以将 -XX:+HeapDumpOnOutOfMemoryError
参数添加到我的 JBoss 启动脚本的 JVM 启动选项中,以便在我们遇到内存不足错误时获取堆转储应用.我想知道这些数据在哪里转储?它只是到控制台,还是某个日志文件?如果只是到控制台,如果我不是通过控制台登录到Unix服务器怎么办?
I was told I can add the -XX:+HeapDumpOnOutOfMemoryError
parameter to my JVM start up options to my JBoss start up script to get a heap dump when we get an out of memory error in our application. I was wondering where this data gets dumped? Is it just to the console, or to some log file? If it's just to the console, what if I'm not logged into the Unix server through the console?
推荐答案
这里是 Oracle 的文档 不得不说:
默认情况下,堆转储是在一个名为 java_pid.hprof 的文件在VM 的工作目录,如上面的例子.您可以指定一个替代文件名或目录使用 -XX:HeapDumpPath=
选项.为了示例 -XX:HeapDumpPath=/disk2/dumps
将导致堆转储在 /disk2/dumps
中生成目录.
By default the heap dump is created in a file called java_pid.hprof in the working directory of the VM, as in the example above. You can specify an alternative file name or directory with the
-XX:HeapDumpPath=
option. For example-XX:HeapDumpPath=/disk2/dumps
will cause the heap dump to be generated in the/disk2/dumps
directory.
这篇关于将 HeapDumpOnOutOfMemoryError 参数用于 JBoss 的堆转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!