Search Blog

Search duranek.blogspot.com

Thursday, April 15, 2010

Eclipse & Could not reserve enough space for object heap

Hi,

In our RCP it's vital to start jvm in the same process as eclipse.exe, so we used the feature of equinox launcher to specify location of the jvm.dll as -vm property value. It was working fine until we tried to increase maximum size heap to 1100m (-vmargs -Xmx1100m) on a machine with 2GB of Ram. When we try to start it like that, we get a splash screen for a sec and after that we get the dialog "JVM terminated. Exit code=-1....". In console window we see "Error occured during initialization of VM. Could not reserve enough space for object heap."
After trying different things, we finally tried to start java in different process by specifying location of java.exe as -vm parameter to eclipse.exe. In that case we were able to start our app with -Xmx1500m without any problem.
Could somebody, pls, explain to me what's going on and if it's possible to solve that problem. Is that a problem in how eclipse.exe is loadind jvm.dll or jvm.dll is not able to handle such situation?

Same happens with official 3.3 relise as well as with the latest 3.3.1.1.
Any info/advice on how to solve that problem would be appreciated.

Thanks in advance,
Viktor

--------

The problem is that the jvm requires a contiguous block of memory. When shared
libraries are loaded by the process, they are placed at their preferred base
address in our memory space. In particular, a windows library COMCTL32.DLL
which we need for graphics (ie splashscreen) has a preferred base address of
0x5D090000 which places it in the middle of the space, which shrinks the largest
block of memory available for -Xmx.

More memory is available when running java.exe because it does not load the same
libraries right away.

Libraries can be loaded at other locations if their preferred address is already
in use, but we don't currently have a way to force this to make more memory
available for -Xmx.

-Andrew