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.)