您为运行Eclipse找到的最佳JVM设置是什么?


当前回答

Eclipse喜欢大量的RAM。至少使用-Xmx512M。更多,如果有。

其他回答

Eclipse Indigo 3.7.2设置(64位linux)

在x86-64 Linux上运行的Sun/Oracle java版本“1.6.0_31”和Eclipse 3.7的设置:

-nosplash
-vmargs
-Xincgc
-Xss500k
-Dosgi.requiredJavaVersion=1.6
-Xms64m
-Xmx200m
-XX:NewSize=8m
-XX:PermSize=80m
-XX:MaxPermSize=150m
-XX:MaxPermHeapExpansion=10m
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=70
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseParNewGC
-XX:+CMSConcurrentMTEnabled
-XX:ConcGCThreads=2
-XX:ParallelGCThreads=2
-XX:+CMSIncrementalPacing
-XX:CMSIncrementalDutyCycleMin=0
-XX:CMSIncrementalDutyCycle=5
-XX:GCTimeRatio=49
-XX:MaxGCPauseMillis=20
-XX:GCPauseIntervalMillis=1000
-XX:+UseCMSCompactAtFullCollection
-XX:+CMSClassUnloadingEnabled
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+AggressiveOpts
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses

注意,这仅为堆使用了200 MB,非堆使用了150 MB。如果你在使用 对于巨大的插件,你可能想增加“-Xmx200m”和“-XX:MaxPermSize=150m”的限制。

这些标志的主要优化目标是在所有情况下最小化延迟,次要优化目标是最小化内存使用。

下面是我自己在i7 2630M 16GB内存笔记本电脑上运行Eclipse的设置,这个设置已经使用了一周,没有一次崩溃,Eclipse 3.7运行平稳。

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms1024m
-Xmx4096m 
-XX:MaxPermSize=256m

计算: 适用于win7 x64

Xms =物理内存/ 16 Xmx =物理内存/ 4 MaxPermSize =保持默认值256m

以下是我使用的方法(尽管我在快捷方式而不是设置文件中使用了它们):

eclipse.exe -showlocation -vm "C:\Java\jdk1.6.0_07\bin\javaw.exe" -vmargs -Xms256M -Xmx768M -XX:+UseParallelGC -XX:MaxPermSize=128M

Eclipse Ganymede 3.4.2设置


有关最新的设置,请参阅上面的Eclipse Galileo 3.5设置。


JDK

在我看来,最好的JVM设置总是包括你能找到的最新JDK(所以目前为止,jdk1.6.0_b07到b16,除了b14和b15)

eclipse.ini

即使有这么低的内存设置,我也可以用2Go RAM在我2002年的旧台式机上运行大型java项目(以及web服务器)。

-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256M
-framework
plugins\org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vm
jdk1.6.0_10\jre\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss2m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:CompileThreshold=5
-Dcom.sun.management.jmxremote

请看GKelly的SO回答和Piotr Gabryanczyk的博客文章,了解更多关于新选项的细节。

监控

你也可以考虑发布:

C:\[jdk1.6.0_0x path]\bin\jconsole.exe

正如之前关于内存消耗的问题所述。

XX:+UseParallelGC,这是有史以来最棒的选择!!