There is insufficient memory for the Java Runtime Environment to continue
Environment
- Red Hat Enterprise Linux
- Windows
Issue
- When starting the Java application (e.g. JBoss) the following error is thrown:
There is insufficient memory for the Java Runtime Environment to continue..
Resolution
- Set the
datalimit tounlimited. See How to set limits for services in RHEL and systemd. - 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.
Root Cause
-
On RHEL8+, the
datalimit is restricted (not set tounlimited). See Calls to mmap() returning allocation failure (ENOMEM) on RHEL 8. -
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.
Diagnostic Steps
On RHEL8+, check if the data limit is restricted (set to something other than unlimited):
$ ulimit -d
131072
- Inspect/compare
java -versionoutput 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.