Java 6 Update 25 VM崩溃:内存不足 [英] Java 6 Update 25 VM crash: insufficient memory

查看:505
本文介绍了Java 6 Update 25 VM崩溃:内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关此问题的更新,请参阅下文。



对于我)jvm 崩溃不是OutOfMemoryError
(崩溃的应用程序是eclipse 3.6.2)。
然而,查看崩溃日志让我想:

 
#内存不足Java运行时环境继续。
#本机内存分配(malloc)无法为Chunk :: new
分配65544字节#可能的原因:
#系统不在物理RAM或交换空间
#In 32位模式,进程大小限制被命中
#可能的解决方案:
#减少系统上的内存负载
#增加物理内存或交换空间
#检查交换后备存储是满的
#在64位操作系统上使用64位Java
#减少Java堆大小(-Xmx / -Xms)
#减少Java线程数量
#减少Java线程堆栈大小(-Xss)
#使用-XX设置较大的代码高速缓存:ReservedCodeCacheSize =
#此输出文件可能被截断或不完整。

当前线程(0x531d6000):JavaThreadC2 CompilerThread1守护程序
[_thread_in_native,id = 7812,stack(0x53af0000,0x53bf0000)]

堆栈:[0x53af0000 ,0x53bf0000],sp = 0x53bee860,可用空间= 1018k
本机框架(J =编译Java代码,j =解释,Vv = VM代码,C =本地代码)
V [jvm.dll + 0x1484aa]
V [jvm.dll + 0x1434fc]
V [jvm.dll + 0x5e6fc]
V [jvm.dll + 0x5e993]
[jvm.dll + 0x27a571]
V [jvm.dll + 0x258672]
V [jvm.dll + 0x25ed93]
V [jvm.dll + 0x260072]
V [jvm.dll + 0x24e59a]
V [jvm.dll + 0x47edd]
V [jvm.dll + 0x48a6f]
V [jvm.dll + 0x12dcd4]
V [jvm.dll + 0x155a0c]
C [MSVCR71.dll + 0xb381]
C [kernel32.dll + 0xb729]

我使用Windows XP 32位SP3。我有4GB RAM。
在启动应用程序之前,我根据任务管理器(+ 1 GB系统缓存,可能也被释放)有2 GB的空闲。我肯定有足够的可用内存。



从开始直到崩溃,我使用visualvm和jconsole记录了jvm内存统计信息。
我获得了内存消耗统计直到崩溃的最后时刻。



统计数据显示以下分配的内存大小:





谁可以帮助我(注意:我最近从Eclipse 3.4.2升级到Eclipse 3.6.2,从Java 5升级到Java 6.我怀疑这里有什么问题?崩溃之间的连接和这些更改,因为我没有看到这些)



UPDATE



这似乎是一个jvm错误 Java 6 Update 25 中引入,并且与新的jit编译器有关。另请参见此博客条目
根据博客修复这个bug应该是下一个java 6更新的一部分。
同时,我在崩溃期间得到了一个本地栈跟踪。我已更新上述崩溃日志。



建议的解决方法,使用vm参数 -XX:-DoEscapeAnalysis (至少显着降低了崩溃的概率)

解决方案

我在工作中偶然遇到了类似的问题。我们为我们的应用程序设置了-Xmx65536M,但仍然得到完全相同的错误。有趣的是,错误总是发生在我们的应用程序实际上做相当轻量级计算的时候,因此无法接近这个限制。



我们发现在线问题的可能解决方案: http://www.blogsoncloud.com/jsp/techSols/java-lang-OutOfMemoryError-unable-to-create-new-native-thread.jsp ,它似乎解决了我们的问题。在将-Xmx降低到50G之后,我们没有遇到这些问题。



在这种情况下实际发生的事情对我们来说仍然有些不清楚。


For an update of this question - see below.

I experience a (reproducible, at least for me) jvm crash (not an OutOfMemoryError) (The application which crashes is eclipse 3.6.2). However, looking at the crash log makes me wonder:

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 65544 bytes for Chunk::new
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.

Current thread (0x531d6000):  JavaThread "C2 CompilerThread1" daemon 
[_thread_in_native, id=7812, stack(0x53af0000,0x53bf0000)]

Stack: [0x53af0000,0x53bf0000],  sp=0x53bee860,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x1484aa]
V  [jvm.dll+0x1434fc]
V  [jvm.dll+0x5e6fc]
V  [jvm.dll+0x5e993]
V  [jvm.dll+0x27a571]
V  [jvm.dll+0x258672]
V  [jvm.dll+0x25ed93]
V  [jvm.dll+0x260072]
V  [jvm.dll+0x24e59a]
V  [jvm.dll+0x47edd]
V  [jvm.dll+0x48a6f]
V  [jvm.dll+0x12dcd4]
V  [jvm.dll+0x155a0c]
C  [MSVCR71.dll+0xb381]
C  [kernel32.dll+0xb729]

I am using Windows XP 32-bit SP3. I have 4GB RAM. Before starting the application I had 2 GB free according the task manager (+ 1 GB system cache which might be freed as well.). I am definitely having enough free RAM.

From the start till the crash I logged the jvm memory statistics using visualvm and jconsole. I acquired the memory consumption statistics until the last moments before the crash.

The statistics shows the following allocated memory sizes:

  • HeapSize: 751 MB (used 248 MB)
  • Non-HeapSize(PermGen & CodeCache): 150 MB (used 95 MB)
  • Size of memory management areas (Edenspace, Old-gen etc.): 350 MB
  • Thread stack sizes: 17 MB (according to oracle and due the fact that 51 threads are running)

I am running the application (jre 6 update 25, server vm) using the parameters:

-XX:PermSize=128m
-XX:MaxPermSize=192m
-XX:ReservedCodeCacheSize=96m
-Xms500m
-Xmx1124m

Question:

  • Why does the jvm crash when there's obviously enough memory on the vm and OS?
    With the above settings I think that I cannot hit the 2GB 32-bit limit (1124MB+192MB+96MB+thread stacks < 2GB). In any other case (too much heap allocation), I would rather expect an OutOfMemoryError than a jvm crash

Who can help me to figure out what is going wrong here?

(Note: I upgraded recently to Eclipse 3.6.2 from Eclipse 3.4.2 and from Java 5 to Java 6. I suspect that there's a connection between the crashes and these changes, because I haven't seen these before)

UPDATE

It seems to be a jvm bug introduced in Java 6 Update 25 and has something to do with the new jit compiler. See also this blog entry. According to the blog the fix of this bug should be part of the next java 6 update. In the meanwhile I got a native stack trace during a crash. I've updated the above crash log.

The proposed workaround, using the vm argument -XX:-DoEscapeAnalysis works (at least it notably lowers the probability of a crash)

解决方案

I stumbled upon a similar problem at work. We had set -Xmx65536M for our application but kept getting exactly the same kind of errors. The funny thing is that the errors happened always at a time when our application was actually doing pretty lightweight calculations, relatively speaking, and was thus nowhere near this limit.

We found a possible solution for the problem online: http://www.blogsoncloud.com/jsp/techSols/java-lang-OutOfMemoryError-unable-to-create-new-native-thread.jsp , and it seemed to solve our problem. After lowering -Xmx to 50G, we've had none of these issues.

What actually happens in the case is still somewhat unclear to us.

这篇关于Java 6 Update 25 VM崩溃:内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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