This discussion is archived
1 Reply Latest reply: Jan 19, 2010 6:13 AM by 843829 RSS

-Xmx cannot allocate memory available.

843829 Newbie
Currently Being Moderated
I have a simple Java program that needs to read in a HUGE string array from file, which is likely to consume 4G+ memory.
I managed to use a server that is a 64bit (redhat)Linux and 64bit Java SDK 1.5 and has 16G memory.
now when I try to run the program with

java -Xms1000m -Xmx4000m -jar myApp.jar
it gives me:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

I can see from 'top' command that I still have 14G+ free memory, and why is it impossible to allocate 4G of max. heap ?

Any ideas?
  • 1. Re: -Xmx cannot allocate memory available.
    843829 Newbie
    Currently Being Moderated
    Without known details but it sounds you might not have real 64bit support in place.
    Maybe some 32bit wrapper is used to execute the java process?

    Perhaps you want to proove it and just play a bit with the settings:
    If java -Xms1500m -Xmx1500m works and java -Xms1700m -Xmx1700m fails it seams quite obvious that you face a 32bit adress space limitation.
    (Update: Not sure if 1,6GB applies only to Win32bit; but you got the idea)