Reputation: 11
I am getting the following error when trying to run java with 1G memory.
C:\>java -verbose -Xmx1G
When I run it, I receive the following message:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
It is working fine with max memory set to 768M. I am using Java 7 (build 1.7.0_15-b03).
Here is my system's info
Total Physical Memory: 3,510 MB
Available Physical Memory: 2,393 MB
Virtual Memory: Max Size: 2,048 MB
Virtual Memory: Available: 1,965 MB
Virtual Memory: In Use: 83 MB
OS: Windows XP.
Upvotes: 1
Views: 2925
Reputation: 68715
The heap does not only depend on the available RAM or physical memory. The maximum theoretical heap limit for the 32-bit JVM is 4G. Due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower.
Upvotes: 1