There is insufficient memory for the Java Runtime Environment to continue

Solution Unverified - Updated

Environment

  • Red Hat Enterprise Linux

    • 5.x
    • 6.x
  • Windows 7

Issue

  • When starting JBoss the following error is thrown:
There is insufficient memory for the Java Runtime Environment to continue..

Resolution

  • Move to a 64-bit JDK or reduce the heap size so that JBoss will be able to start within the 4 GB memory space.
  • Verify there is adequate free memory on the OS/host to support the configured maximum heap size (-Xmx)

Root Cause

  • 32-bit applications have a maximum of 4 GB addressable memory space. When JBoss was starting it was approaching this limit and unable to obtain the requested memory.

  • If already using 64-bit jdk and using Hive, check the Hive configuration whether it is compatible with the running Java version.

Diagnostic Steps

  • When starting JBoss the following error is thrown in the bootstrap.log:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 37544 bytes for Chunk::new
# An error report file with more information is saved as:
# /tmp/hs_err_pid<pid>.log
  • Observed the following error in the hs_err_<pid> file created:
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 37544 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=22229, tid=574196624
#
# JRE version: 6.0_31-b04
# Java VM: Java HotSpot(TM) Server VM (20.6-b01 mixed mode linux-x86 )
  • Inspect/compare java -version output to make sure the JVM is not unexpectedly 32-bit:
$ java -version
$ java -d32 -version (Solaris/Linux)
$ java -d64 -version (Solaris/Linux)
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.