Just faced with strange issue. When i type
java -version
i got
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
.
java -Xms64m -Xmx64m -version
This command works fine
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode)
If i change xms, xmx to 128m, i get error again.
Using top command and free -m i can see, that i got over 192 mb free, so why i still get this error ?
Mem: 262144k total, 64760k used, 197384k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
Thank you
It looks like the machine you’re trying to run this on has only 256 MB memory.
Maybe the JVM tries to allocate a large, contiguous block of 64 MB memory. The 192 MB that you have free might be fragmented into smaller pieces, so that there is no contiguous block of 64 MB free to allocate.
Try starting your Java program with a smaller heap size, for example: