Eclipse: Changing the Java Heap Size

eclipseiconI just won a battle against Eclipse, managing to finally rid myself of a string of strange out-of-heap warnings. It is a long story, involving lots of web searching and fiddling with the eclipse.ini file options for the JVM. It just never seemed to work as I wanted it to, despite changing the -Xmx VM argument to 256, then 512, and finally 1024m.

Turned out that the problem was not at all related to the names of the parameters to the VM. Xmx is the right way to grow the heap.This set of parameters does work when put into an eclipse.ini file (for Eclipse 3.5):

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m

The problem was that Eclipse actually never read its eclipse.ini file, because I had changed the name of the main Eclipse binary. I have several Eclipse installations with different versions active at the same time, and to bring some sanity to shortcuts and Windows start menu items, I started renaming the executables to include the version name. Thus, I had “eclipse-3.5.1.exe” rather than “eclipse.exe” in the problematic case.

It seems that eclipse when starting reads a file like “my-file-name”.ini, and thus all changes to the file “eclipse.ini” has no effect for “eclipse-3.5.1.exe”.

Why do I always find these bugs?

Leave a Reply

Your email address will not be published. Required fields are marked *