Sometimes, this error indicates that physical memory and swap on the server actually are fully utilized!
I was seeing this problem recently on a server running RedHat Enterprise Linux 5.7 with 48 GB of RAM. I found that even just running
java -version
caused the same error, which established that the problem was not specific to my application.
Running
cat /proc/meminfo
reported that MemFree and SwapFree were both well under 1% of the MemTotal and SwapTotal values, respectively:
MemTotal: 49300620 kB
MemFree: 146376 kB
...
SwapTotal: 4192956 kB
SwapFree: 1364 kB
Stopping a few other running applications on the machine brought the free memory figures up somewhat:
MemTotal: 49300620 kB
MemFree: 2908664 kB
...
SwapTotal: 4192956 kB
SwapFree: 1016052 kB
At this point, a new instance of Java would start up okay, and I was able to run my application.
(Obviously, for me, this was just a temporary solution; I still have an outstanding task to do a more thorough examination of the processes running on that machine to see if there's something that can be done to reduce the nominal memory utilization levels, without having to resort to stopping applications.)
sudo apt install openjdk-17-jdk openjdk-12-jdk-
, the dash at the end ofopenjdk-12-jdk
tells system to uninstall that package while installing another) things started to work as expected again.Not enough space available on the backing filesystem to hold the current max
andForcefully lowering max Java heap size to 0M
. The interesting thing was that I had-Xmx3000m
and system had 16 GB free RAM and filesystem had ~60 GB free space. Andjava
forcing the max heap size to zero is obviously not going to work so I guess that's some weird bug in JVM.