Starting JVM gets error Cannot allocate memory - errno=12 on OpenJDK 8
Issue
When starting a JVM with Shenandoah or G1GC, the following error occurs:
$JAVA_HOME/bin/java -XX:+ShenandoahLogDebug -Xmx20G -Xms2G -XX:+UseShenandoahGC -Dfoo=example ExampleApplication
Regions: 2560 x 8192K
Humongous object threshold: 8192K
Max TLAB size: 1024K
GC threads: 1 parallel, 1 concurrent
Heuristics ergonomically sets -XX:+ExplicitGCInvokesConcurrent
Heuristics ergonomically sets -XX:+ShenandoahImplicitGCInvokesConcurrent
Shenandoah GC mode: Snapshot-At-The-Beginning (SATB)
Shenandoah heuristics: Adaptive
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000002c0000000, 2147483648, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2147483648 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /root/example_path/hs_err_pid26149.log
$JAVA_HOME/bin/java -XX:+ShenandoahLogDebug -Xmx20G -Xms2G -XX:+UseG1GC -Dfoo=example ExampleApplication
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000002c0000000, 2147483648, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2147483648 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /root/example_path/hs_err_pid26153.log
But does not occur in ParallelGC, which is the default for OpenJDK 8, even with a higher Xms
value:
$JAVA_HOME/bin/java -Xmx20G -Xms2G -Dfoo=example GetValue
Application running
example
Environment
- OpenJDK 8
- OpenJDK 11
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.