tags:

views:

288

answers:

2

Running Eclipse 3.5.1, JDK 1.6.0_17 on WinXP SP3 32Bit with 3.5 gigs of RAM.
I'm aware of the known Eclipse best practices, still trying to figure out eclipse.ini.

This will launch: -Xmx588m and this won't: -Xmx589m.
Same with -XX:MaxPermSize. Anything above -XX:MaxPermSize=140m won't launch.
The screen of death is simlar to this (taken from here).

Any ideas on why might this be happening?

+2  A: 

See this eclipse bug.

The general problem is the jvm requires a contiguous block of memory for this. On windows, the process will be getting 2 Gigs, other libraries that get loaded are placed in different areas of the memory space. If a library happens to get placed in the middle, in basically cuts in half the size you can use.

The Eclipse launcher will be loading some system dlls to do graphics, and in particular, user32.dll can result in 3rd party libraries getting loaded depending what is installed on your machine (seen here).

To achieve higher memory limits, you can force the jvm to be forked into a separate process from the eclipse launcher. The jvm process won't be loading these extra libraries until after the vm has initialized its memory. Do this by using a -vm argument pointing to a javaw.exe:

eclipse -vm C:\jdk\jre\bin\javaw.exe
Andrew Niefer
+1  A: 

See also this bug 203325 for suggestions about how monitoring how your memory is used, with tools like:

  • JConsole
  • Memory Monitor tool (eclipse tool)

Note: as commented here:

If You do not declare the maximum memory limit then it is left to the OS memory manager.

The -Xmx <size> is useful for programming a small device like J2ME.
If you are programming for a small device which is memory constrained then you can use -Xmx JVM property to emulate the small device, even though you may be using a PC.

VonC