昨天,原来公司的一个同事的服务器遇到了一个问题。服务器在启动不久以后,突然的crash,并且在log中有如下的记录:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1066656 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.
#
# Out of Memory Error (allocation.cpp:317), pid=7684, tid=776207248
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) Server VM (20.1-b02 mixed mode linux-x86 )
--------------- T H R E A D ---------------
Current thread (0x2f3df800): JavaThread "C2 CompilerThread1" daemon [_thread_in_native, id=7699, stack(0x2e3bf000,0x2e440000)]
Stack: [0x2e3bf000,0x2e440000], sp=0x2e43cfb0, free space=503k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x7248b0]
这个问题原来还真没遇到过。查了一下资料,貌似是java 6u25以及6u26存在的一个bug。这个bug应该是涉及到逃逸分析方面的。具体描述请看http://stackoverflow.com/questions/6344546/java-6-update-25-vm-crash-insufficient-memory。
解决的方案有两种,一种是换java虚拟机版本,另外一种是添加启动参数:-XX:-DoEscapeAnalysis