what is the right way to set JVM param's in eclipse

Raven picture Raven · Aug 1, 2012 · Viewed 44k times · Source

i am using eclipse 4.2 to execute a junit test. the test uses a lot of memory so what i want to do is to enlarge the memory allocated to the jvm. i wanted to know if there is a differences between setting the heap memory param's in the eclipse ini file and the run configuration?

Answer

Kilian Foth picture Kilian Foth · Aug 1, 2012

Note the memory settings for Java processes started by eclipse are different from the maximum allowed memory size for eclipse itself.

The allowance for eclipse itself is set on startup by

-vmargs -Xmx1024M -Xms1024M -XX:PermSize=2048m -XX:MaxPermSize=2048m

Note that the m in "mx" is case sensitive, while the m in "1024M" is case insensitive; and the single-X options are spelt without "=", but the double-X options are spelt with "=".

The memory size for JVMs started by eclipse, which is what you want to influence unit tests, is set within eclipse:

Window::Preferences::Java::Installed JREs::Edit::Default Vm Arguments: -Xms128M -Xmx2048M

(Exact titles of menu entries may vary by eclipse version.)