简体   繁体   English

堆转储何时生成

[英]heap dump when it will get generated

In my Java application a heap dump file gets generated when I read from the OutputStream of a script. 在我的Java应用程序中,当我从脚本的OutputStream中读取时,会生成堆转储文件。 I am sure about a memory leak in my application. 我确信我的应用程序中存在内存泄漏。 But even after the heap dump got generated, the thread which is causing the memory leak is not coming out. 但即使在生成堆转储之后,导致内存泄漏的线程也不会出现。 I am not catching Throwable, Exception, Error etc in the run method. 我没有在run方法中捕获Throwable,Exception,Error等。

I want to know when the Heap Dump file will get generated when I have not specified any special VM argument like 我想知道当我没有指定任何特殊的VM参数时,何时生成堆转储文件

-XX:+HeapDumpOnOutOfMemoryError

AFAIK, heapdumps are only automatically generated if you specify that option, at least in Oracle's JVM (don't know about the others, but I doubt they do it automatically). AFAIK,只有在你指定该选项时才会自动生成堆转换,至少在Oracle的JVM中是这样(不知道其他的,但我怀疑它们会自动执行)。

In most cases you have to trigger heap dump generation manually. 在大多数情况下,您必须手动触发堆转储生成。

There are also ways to programmatically create a heap dump, but those are JVM specific and depend on how and when the programmer calls them. 还有一些以编程方式创建堆转储的方法,但这些方法是特定于JVM的,并且取决于程序员调用它们的方式和时间。 If that option is used then you'd have to look for that as it could be anywhere. 如果使用该选项,那么你必须寻找它,因为它可能在任何地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM