Eclipse的JVM参数设置

发表于: java/j2ee | 作者: | 日期: 2009/4/21 10:04

为了找到Eclipse JVM的最优设置,我反复研究了sun工程师的演说与资料并经过了反复试验,以下是我找到的最优设置:

-vmargs -XX:+UseParallelGC

我的系统环境是双核+Windows+JDK5.0+Eclipse。

以上参数在命令行下启动Eclipse也是可用的。接下来我们讨论一下 JDK5.0 中垃圾回收器的”ergonomics”特性,这个特性可以使JVM实现自动控制。这个特性仅仅在使用UseParallelGC collector (也被称为parallel scavenge collector)的时候会被激活。注意使用该特性的时候无需通过-XmxNNNm 来设置堆空间。根据相关的资料,任何其他的参数设置都会使 JVM 无法实现自动控制。因为只要我们设置了其他参数,JVM就会使用我们的参数设置而忽略自身的”ergonomics”特性(JVM以为我们更了解其内在的机制,其实不然)。

如何想查看垃圾回收器的日志信息,我们可以使用以下的参数(不要换行)设置将日志信息输出到指定的文件中:

-vmargs -Xloggc:c:tempe.txt -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -verbose:gc -XX:+UseParallelGC

原文:

In my neverending quest to find the best JVM settings for running Eclipse I’ve been pouring over talks and papers given by Sun engineers and trying different things. Here are the best options that I’ve found so far for my 2-processor Windows machine running JDK5.0 and Eclipse3.1:

-vmargs -XX:+UseParallelGC

These go on the Eclipse executable’s command line. What I’m doing here is taking advantage of the JDK5.0 garbage collection “ergonomics” feature to let the JVM self tune. It’s only active with the UseParallelGC collector (also called the parallel scavenge collector). Note there is no -XmxNNNm option to set the heap size. According to the doc, any sizing or tweaking options will disable self tuning because it figures we know better than it does (it doesn’t know us very well does it?).

If you want to see what the garbage collector is doing you could add more printing options like this (all on one line) to dump some logging information to a file that you can view or process later:

-vmargs -Xloggc:c:tempe.txt -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution -verbose:gc -XX:+UseParallelGC

原文链接:
http://www.eclipsezone.com/eclipse/forums/t20732.html

参考链接:
JVM参数设置大全

JVM参数设置大全压缩版

: https://blog.darkmi.com/2009/04/21/851.html

本文相关评论 - 1条评论都没有呢
Post a comment now » 本文目前不可评论

No comments yet.

Sorry, the comment form is closed at this time.