Java Runtime Environment没有足够的内存来继续

时间:2015-08-24 08:51:08

标签: java jvm jit

我的Java应用程序在JIT编译期间工作了几天后失败了。 可能是本机内存碎片整理,但它只需要8Kb ... 我有超过700个线程。堆的2Gbs(当jvm失败时仅使用1Gb) 请帮忙解决这个问题。

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 8192 bytes for committing reserved memory.
# 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 (os_solaris.cpp:2677), pid=25465, tid=47
#
# JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode solaris-sparc compressed oops)
# Core dump written. Default location: /location/core or core.25465
#

---------------  T H R E A D  ---------------

Current thread (0x0000000100c75000):  JavaThread "C2 CompilerThread3" daemon [_thread_in_vm, id=47, stack(0xffffffff58d00000,0xffffffff58e00000)]

Stack: [0xffffffff58d00000,0xffffffff58e00000],  sp=0xffffffff58dfcfd0,  free space=1011k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xddc994]  void VMError::report_and_die()+0x6e4
V  [libjvm.so+0x5347d4]  void report_vm_out_of_memory(const char*,int,unsigned long,VMErrorType,const char*)+0x64
V  [libjvm.so+0xb7304c]  int os::Solaris::commit_memory_impl(char*,unsigned long,bool)+0x10c
V  [libjvm.so+0xb73334]  bool os::pd_commit_memory(char*,unsigned long,unsigned long,bool)+0x2c
V  [libjvm.so+0xb66354]  bool os::commit_memory(char*,unsigned long,unsigned long,bool)+0x2c
V  [libjvm.so+0xdd756c]  bool VirtualSpace::expand_by(unsigned long,bool)+0x150
V  [libjvm.so+0x684364]  bool CodeHeap::expand_by(unsigned long)+0xc8
V  [libjvm.so+0x492038]  CodeBlob*CodeCache::allocate(int,bool)+0xa0
V  [libjvm.so+0xb1e08c]  nmethod*nmethod::new_nmethod(methodHandle,int,int,CodeOffsets*,int,DebugInformationRecorder*,Dependencies*,CodeBuffer*,int,OopMapSet*,ExceptionHandlerTable*,ImplicitExceptionTable*,AbstractCompiler*,int)+0x2d0
V  [libjvm.so+0x3ec93c]  void ciEnv::register_method(ciMethod*,int,CodeOffsets*,int,CodeBuffer*,int,OopMapSet*,ExceptionHandlerTable*,ImplicitExceptionTable*,AbstractCompiler*,int,bool,bool,RTMState)+0x524
V  [libjvm.so+0x4b6c90]  Compile::Compile(ciEnv*,C2Compiler*,ciMethod*,int,bool,bool,bool)+0x1380
V  [libjvm.so+0x3b4898]  void C2Compiler::compile_method(ciEnv*,ciMethod*,int)+0xa8
V  [libjvm.so+0x4d02b8]  void CompileBroker::invoke_compiler_on_method(CompileTask*)+0xeb0
V  [libjvm.so+0x4cebf8]  void CompileBroker::compiler_thread_loop()+0x490
V  [libjvm.so+0xd2611c]  void JavaThread::thread_main_inner()+0x94
V  [libjvm.so+0xd26068]  void JavaThread::run()+0x398
V  [libjvm.so+0xb6dcb0]  java_start+0x390
C  [libc.so.1+0xe2464]  _lwp_start+0x8

2 个答案:

答案 0 :(得分:1)

我不了解solaris,但是linux有sysctl vm.max_map_count,它限制了虚拟内存映射的最大数量

因此,虽然可能有足够的可用物理RAM和虚拟地址空间,但它可能会超出允许的映射数量。

答案 1 :(得分:0)

问题是操作系统报告它没有虚拟内存。我会看看你有多少免费交换空间,并考虑增加它。

为系统提供更多可用交换空间的一种方法是,如果不全部使用,则减少堆大小。

注意:GB =千兆字节,Gb =千兆位。