This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have 8GB memory and I am trying to allocate 4GB to one of the java processes as;
java -Xmx4000m testpck.testPrg
But this seems to give the following error:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
I have double checked my RAM size and it is 8GB with 16G swap space. What could I be possibly missing? Is there some other setting in jvm options I need to specify?
sayali s kulkarni wrote:
If yes, the max memory that I can get with 32-bit version is just 2.5G even when my RAM is 8gig?
How much memory available to the JVM depends on it works with the OS. With a 32 bit JVM, the theoretical maximum is 4 gig -- with most 32 bit JVMs, it is around 2 gig. You are actually lucky with 2.5 gig. I seen it as low as less than 1.5 gig.
Why don't you install a 64 bit JVM? This way, you can use a lot more memory -- well, until the GC starts to choke...
sayali s kulkarni
Joined: Nov 13, 2010
Thanks a lot for the tips Henry. Will try with a 64-bit JVM.