Java cannot reserve enough memory for object heap

Mark Hansen

Bit poster
When running Java on WinXP guest, I get the following error whenever I set the maximum heap size greater than 512MB:

----------

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

----------

I have my JAVA_OPTS environment variable set at "-Xms512m -Xmx1024". Setting the -Xmx to anything more than 512 seems to cause this error.

My company builds Java server software. I use Parallels on the Mac for development and demos. We need to be able to set the memory higher. Please help!
 
This problem is due to the Kapersky anti-virus product that comes with Parallels. I was not having this problem on my Parallels 3 VM where I don't run an AV program. However I was able to reproduce the issue by importing Mark's Parallels 4.0 VM into VMWare fusion and found the same limitation for Java. I therefore concluded that the problem was not specifically related to the VM software but rather to the particular Windows image.

Turning off the AV program had no effect but after I uninstalled it and rebooted, I was then able to run java with a -Xmx1600 value. Mark then uninstalled it from his Parallels VM and the problem went away there too.

What's quite bizarre to me is how much of a difference it made. The available heap size for Java went from 512M to 1.6G after uninstalling the anti-virus program. Upon reflection and some external discussion, it seems that all that would be necessary for this to happen is if the AV program grabs a single chunk of address space in every process and if that address is low enough, then a user program trying to allocate a large chunk of memory going beyond that address would fail.
 
Last edited:
Back
Top