简体   繁体   English

哪个线程触发了OutOfMemoryException堆转储

[英]Which thread triggered an OutOfMemoryException heap dump

I've got a JBoss 4.2.1 application running on a JVM 7 that has triggered heap dumps when it throws OutOfMemoryExceptions . 我有一个运行在JVM 7上的JBoss 4.2.1应用程序,该应用程序在抛出OutOfMemoryExceptions时触发了堆转储。 I have the jvm configured with the following switches: 我为jvm配置了以下开关:

-Xms1498m -Xmx3000m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError

I am trying to read through the heap dumps to figure out exactly what caused my OOME. 我正在尝试通读堆转储,以找出导致OOME的确切原因。 I see large blocks of memory consumed, but they are somewhat expected. 我看到消耗了大块内存,但是有些期望。 What I am looking for at the moment is the "smoking gun". 我目前正在寻找的是“吸烟枪”。

I've already opened another SO issue here regarding missing memory in my heap dump, so I'm trying to figure out what the JVM was doing when the OOME occurred. 我已经在这里打开另一个SO问题,涉及堆转储中的内存丢失,因此,我试图弄清OOME发生时JVM的功能。

Is there anything in the heap dump that would indicate which thread triggered the OOME? 堆转储中是否有任何内容可以指示哪个线程触发了OOME? More specifically what the call that triggered my OOME was doing? 更具体地说,触发我的OOME的电话在做什么? I realize and understand that in the case of memory leaks, this might be chasing the wrong trail, but I'm looking to see if I see which thread caused the exception. 我意识到并了解,在发生内存泄漏的情况下,这可能是在追寻错误的线索,但是我正在寻找是否看到哪个线程导致了异常。

Is there anyway to use MAT to see this? 反正有使用MAT来查看此内容吗?

Have you checked the thread overview in MAT? 您是否在MAT中检查了线程概述? 线程概述

It won't tell you the thread that triggered the OOME but will give info on retained heap. 它不会告诉您触发OOME的线程,但会提供有关保留堆的信息。

We don't really care actually which thread causes the OOME as it would not prove anything, think about a thread that does a simple task with no leak, if the heap is already nearly full and this thread creates even a small Object it could cause the OOME without being the root cause of the memory leak. 我们实际上并不在乎哪个线程会导致OOME因为它无法证明任何事情,请考虑一个没有泄漏的简单任务的线程,如果堆已经快满了,并且该线程甚至创建了一个小的Object ,可能会导致OOME。 OOME内存泄漏的根本原因。

Regarding your actual question I don't believe that you can know which Thread caused the OOME from a heap dump, the only way is to check your console or your log file as the JVM prints the stack trace into the standard output on OOME . 关于您的实际问题,我不相信您可以知道是哪个Thread从堆转储中导致了OOME ,唯一的方法是检查控制台或日志文件,因为JVM将堆栈跟踪打印到OOME的标准输出中。

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

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