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

3

8

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?

Shandishandie answered 1/8, 2012 at 11:12 Comment(0)
S
12

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.)

Sidoney answered 1/8, 2012 at 11:15 Comment(0)
F
4

you can increase heap size in eclipse.ini file like below.

 -Xms1024m
 -Xmx1024m
 -XX:MaxPermSize=256m
Fermi answered 1/8, 2012 at 11:15 Comment(0)
C
3

If you set it in eclipse.ini, it applies to the Eclipse process itself - not to any new Java processes you start from Eclipse.

If you set it in the Run Configuration, it only applies to that run configuration, but not to Eclipse itself.

Since your unit test is using a lot of memory, it won't matter how much memory Eclipse has available. The unit test will run in a new Java process, with default memory allocation.

Conflagration answered 1/8, 2012 at 11:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.