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

牧云@^-^@ 提交于 2019-12-03 12:53:22

问题


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?


回答1:


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




回答2:


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

 -Xms1024m
 -Xmx1024m
 -XX:MaxPermSize=256m



回答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.



来源:https://stackoverflow.com/questions/11758010/what-is-the-right-way-to-set-jvm-params-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!