如何检测OutofMemoryError的原因? [英] How to detect the cause of OutofMemoryError?

查看:561
本文介绍了如何检测OutofMemoryError的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个抱怨说,我的服务器应用程序正在高负载崩溃。

这是一个在 Tomcat 5 中运行的Web应用程序。 br>
我看到线程转储,我看到有一个OutOfMemory错误


1TISIGINFO转储事件systhrow(00040000 )详细信息

java / lang / OutOfMemoryError无法创建线程:retVal -1073741830,errno 12>收到1TIDATETIME日期:2012/07/17在20:03:17 1TIFILENAME> Javacore文件名: C:\ServerApplication\Tomcat5\bin\javacore.34545719.4646464.4172.0003.txt


堆信息如下:

 最大Java堆大小:1500m 
初始Java堆大小:256m

这是初始和最大堆大小(32位java)的配置



I也看到有可用的空闲空间

  1STHEAPFR EE堆栈空间免费:2D19F3C0 
1STHEAPALLOC分配的堆空间字节数:5DC00000

是750英尺的可用空间,对吧?



从线程方法分析我看到线程数是 695 其中 49% java / lang / Object.wait(Native Method) 39% sun / misc / Unsafe.park(Native Method)

另外我看到这个 NO JAVA STACK 1% / code>不知道这是什么意思。

另外0踏入死锁, 2%是Runnable。



我不知道如何解释这些信息或如何从这里继续检测潜在的原因。
任何帮助?

解决方案

根据这篇文章


java.lang.OutOfMemoryError有两个可能的原因:
无法创建线程消息:




  • 线程运行太多,系统内存不足,创建新线程。

  • 系统已用完本机内存,用于新线程。线程需要用于内部JVM结构的本机内存,Java™
    堆栈和本机堆栈。


所以这个错误可能与内存完全无关,只是创建了太多的线程...



编辑:



由于你有695个线程,所以你需要695倍的堆栈大小作为内存。考虑到关于线程限制的这篇文章,我怀疑您正在尝试为可用的虚拟内存空间创建太多线程。


I have a complaint that a server application of mine is crashing on high load.
It is a web app running in Tomcat 5.
I see the thread dumps and I see that there is an OutOfMemory error

1TISIGINFO Dump Event "systhrow" (00040000) Detail
"java/lang/OutOfMemoryError" "Failed to create thread: retVal -1073741830, errno 12" >received 1TIDATETIME Date: 2012/07/17 at 20:03:17 1TIFILENAME >Javacore filename:C:\ServerApplication\Tomcat5\bin\javacore.34545719.4646464.4172.0003.txt

The heap information is the following:

Maximum Java heap size : 1500m    
Initial Java heap size : 256m

This is the configuration for initial and Max heap size (32 bit java)

I also see that there is available free heap space

1STHEAPFREE    Bytes of Heap Space Free: 2D19F3C0   
1STHEAPALLOC   Bytes of Heap Space Allocated: 5DC00000

This is arround 750MB free space, right?

And from the thread method analysis I see that the number of Threads is 695 of which 49% is java/lang/Object.wait(Native Method) and 39% is in sun/misc/Unsafe.park(Native Method)
Also I see this NO JAVA STACK 1% not sure what that means.
Also 0 treads deadlocked and 2% is Runnable.

I am not sure how to interpret this information or how to go on from here to detect the underlying cause.
Any help on this?

解决方案

According to this post:

There are two possible causes of the java.lang.OutOfMemoryError: Failed to create a thread message:

  • There are too many threads running and the system has run out of internal resources to create new threads.
  • The system has run out of native memory to use for the new thread. Threads require a native memory for internal JVM structures, a Java™ stack, and a native stack.

So this error may well be completely unrelated to memory, just that too many threads are created...

EDIT:

As you've got 695 threads, you would need 695 times the stack size as memory. Considering this post on thread limits, I suspect that you are trying to create too many threads for the available virtual memory space.

这篇关于如何检测OutofMemoryError的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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