Eclipse 3.2 and "Out Of Memory" errors

I've been working on a project that requires Struts so to speed up my development time i downloaded the latest Exadel Studio Pro (Soon to become Red Hat Developer Studio) for Eclipse. That's when the nightmare started. I followed the installation instructions, including the part that recommends allocating more memory to Eclipse when launching the program. I thought i had the set up done right but to my dismay, my Eclipse kept crashing every 5 minutes or so, especially when i was trying to edit a struts-config.xml through Exadel's diagram view. After a fair amount of googling the topic, i found out that i needed to increase my MaxPermSize from the default 64 Mb to 128Mb at least. Easier said than done. Most posts you will find about the topic will advise you to edit you eclipse.ini file this way:

-vmargs
-Xms512m
-Xmx512m
-XX:MaxPermSize=128m

Seemed pretty easy and straight forward yet it did not work and Eclipse kept crashing. I was put on the right track thanks to Max's Blog. It turns out that Eclipse.ini file has quirks when it comes to the syntax and each argument needs to be put on individual lines, which i have been doing but to no avail. So i decided to take matters in my own hand and specify those same arguments directly when lauching Eclipse. I deleted all the content in my Eclipse.ini and went to the Eclipse's shortcut on my desktop and under the "Shortcut" tag, i specified the target as:

C:\Eclipse-SDK-3.2.1\eclipse\eclipse.exe -vmargs -Xmx512m -Xms256m -XX:MaxPermSize=128m -Dcom.sun.management.jmxremote

Launching Eclipse that way did not give me any "Could Not Start the Java Virtual Machine" errors i have been having using the Eclipse.ini file. It also correctly set my memory settings, which you can check by going to "Help/About Eclipse SDK", "Configuration Details" and then checking your "eclipse.vmargs" value. Mine now looks like this:

eclipse.vmargs=-Xmx512m
-Xms256m
-XX:MaxPermSize=128m
-Dcom.sun.management.jmxremote
-jar
C:\Eclipse-SDK-3.2.1\eclipse\startup.jar

I added the "DCom.sun.management.jmxremote" line on a suggestion from Exadel's blog to be able to monitor my JVM memory usage using Sun's jconsole. If you would like to do the same, include that command to your vmargs and once Eclipse has been launched run a "jconsole" command and choose the Eclipse process from the "local" tab. It should be the only item in the list anyway.

My Eclipse now runs smooth, and i haven't experienced any more "Out Of Memory" errors and i don't have to give up on Exadel's Studio Pro which is a great tool to develop Struts applications by the way.

HIH (Hope It Helps)!

comments powered by Disqus