Java process crashed with the message "Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory."

Solution Verified - Updated -

Issue

My java process crashed with the message "Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory." in fatal error log like (*1-1) below. Also, the stack trace in the fatal error log indicates that the java process crashed when it tried to create stack guard pages for the Java thread like (*1-2).

(*1) Excerpt from fatal error log (hs_err_pid<pid>.log)

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory.    <---------- (*1-1)
# Possible reasons:
#   The system is out of physical RAM or swap space
#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
#   JVM is running with Zero Based Compressed Oops mode in which the Java heap is
#     placed in the first 32GB address space. The Java Heap base address is the
#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
#     to set the Java Heap base and to place the Java Heap above 32GB virtual address.
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2799), pid=206597, tid=0x00007ef34ecad700
#
# JRE version: OpenJDK Runtime Environment (8.0_282-b08) (build 1.8.0_282-b08)
# Java VM: OpenJDK 64-Bit Server VM (25.282-b08 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

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

Current thread (0x00007ef3642f9000):  JavaThread "Thread-32618" [_thread_new, id=239338, stack(0x00007ef34ebad000,0x00007ef34ecae000)]

Stack: [0x00007ef34ebad000,0x00007ef34ecae000],  sp=0x00007ef34ecacae0,  free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xb85429]  VMError::report_and_die()+0x1c9
V  [libjvm.so+0x4ed32f]  report_vm_out_of_memory(char const*, int, unsigned long, VMErrorType, char const*)+0xaf
V  [libjvm.so+0x959456]  os::pd_commit_memory(char*, unsigned long, bool)+0xd6
V  [libjvm.so+0x950e82]  os::commit_memory(char*, unsigned long, bool)+0x32
V  [libjvm.so+0x959e8d]  os::pd_create_stack_guard_pages(char*, unsigned long)+0x7d
V  [libjvm.so+0xb299d3]  JavaThread::create_stack_guard_pages()+0x73    <---------- (*1-2)
V  [libjvm.so+0xb30ad0]  JavaThread::run()+0x1b0
V  [libjvm.so+0x956a82]  java_start(Thread*)+0x162
C  [libpthread.so.0+0x81cf]  start_thread+0xef

Environment

  • OpenJDK
  • Red Hat Enterprise Linux

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content