-XX:+ HeapDumpOnOutOfMemoryError未在OOM中创建hprof文件 [英] -XX:+HeapDumpOnOutOfMemoryError not creating hprof file in OOM

查看:125
本文介绍了-XX:+ HeapDumpOnOutOfMemoryError未在OOM中创建hprof文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下参数启动我的java代码(Vista中的1.6.0_16) -XX:+ HeapDumpOnOutOfMemoryError -XX:HeapDumpPath = .. / logs 。我运行代码,我可以在日志中看到有两个OOM。

I start my java code (1.6.0_16 in Vista) with the following params (among others) -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../logs. I run the code and I can see in the logs there are two OOM.

我知道的第一个因为我可以在stdout中看到正在创建hprof文件:

The first one I know cause I can see in the stdout that the hprof file is being created:

java.lang.OutOfMemoryError: Java heap space
Dumping heap to ../logs\java_pid4604.hprof ...
Heap dump file created [37351818 bytes in 1.635 secs]

然后,在代码的最后,我得到另一个OOM,我捕获了这个,但我没有得到第二个hprof文件。有谁知道为什么?是因为我捕获了OOM异常吗?

And then, towards the end of the code I get another OOM, I capture this, but I don't get a second hprof file created. Anybody knows why is that?? Is it because I have captured the OOM exception?

推荐答案

内存不足只会在第一个错误上生成一个转储文件。如果你想获得更多,你可以尝试jmap或在jvm(版本6)上保留jconsole然后你可以在一切崩溃后,即在早上从jconsole(或你选择的分析工具)创建自己的转储。

Out of memory generates only one dump-file on the first error. If you want to get more you can try jmap or keep jconsole on the jvm (version 6) then you can after everything crashed i.e in the morning create your own dump from jconsole (or your analyser tool of choice).

有关倾销主题的更多信息,请参阅 Eclipse MemoryAnalyser

More on the dumping subject can be read in Eclipse MemoryAnalyser.

这篇关于-XX:+ HeapDumpOnOutOfMemoryError未在OOM中创建hprof文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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