Eclipse 的最佳 JVM 设置是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/142357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:26:17  来源:igfitidea点击:

What are the best JVM settings for Eclipse?

eclipsejvm

提问by Craig Angus

What are the best JVM settings you have found for running Eclipse?

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

采纳答案by VonC

It is that time of year again: "eclipse.ini take 3" the settings strike back!

又是一年中的那个时候:“eclipse.ini take 3”的设置反击!

Eclipse Helios 3.6 and 3.6.x settings

Eclipse Helios 3.6 和 3.6.x 设置

alt text http://www.eclipse.org/home/promotions/friends-helios/helios.png

替代文字 http://www.eclipse.org/home/promotions/friends-helios/helios.png

After settings for Eclipse Ganymede 3.4.xand Eclipse Galileo 3.5.x, here is an in-depth look at an "optimized" eclipse.inisettings file for Eclipse Helios 3.6.x:

在对Eclipse Ganymede 3.4.xEclipse Galileo 3.5.x进行设置后,这里深入了解了 Eclipse Helios 3.6.x的“优化” eclipse.ini设置文件:

(by "optimized", I mean able to run a full-fledge Eclipse on our crappy workstation at work, some old P4 from 2002 with 2Go RAM and XPSp3. But I have also tested those same settings on Windows7)

通过“优化”,我的意思是能够在我们工作中的蹩脚工作站上运行完整的 Eclipse,一些 2002 年的旧 P4 带有 2Go RAM 和 XPSp3。但我也在 Windows7 上测试了这些相同的设置

Eclipse.ini

Eclipse文件

alt text

替代文字

WARNING: for non-windows platform, use the Sun proprietary option -XX:MaxPermSizeinstead of the Eclipse proprietary option --launcher.XXMaxPermSize.
That is: Unlessyou are using the latest jdk6u21 build 7. See the Oracle section below.

警告:对于非 Windows 平台,请使用 Sun 专有选项-XX:MaxPermSize而不是 Eclipse 专有选项--launcher.XXMaxPermSize
那就是:除非您使用的是最新的jdk6u21 build 7。请参阅下面的 Oracle 部分。

-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vm
C:/Prog/Java/jdk1.6.0_21/jre/bin/server/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Declipse.p2.unsignedPolicy=allow
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/Prog/Java/eclipse_addons

Note:
Adapt the p2.reconciler.dropins.directoryto an external directory of your choice.
See this SO answer. The idea is to be able to drop new plugins in a directory independently from any Eclipse installation.

注意:使
适应p2.reconciler.dropins.directory您选择的外部目录。
请参阅此SO 答案。这个想法是能够独立于任何 Eclipse 安装在目录中放置新插件。

The following sections detail what are in this eclipse.inifile.

以下部分详细说明了此eclipse.ini文件中的内容。



The dreaded Oracle JVM 1.6u21 (pre build 7) and Eclipse crashes

可怕的 Oracle JVM 1.6u21(预构建 7)和 Eclipse 崩溃

Andrew Nieferdid alert me to this situation, and wrote a blog post, about a non-standard vm argument (-XX:MaxPermSize) and can cause vms from other vendors to not start at all.
But the eclipse version of that option (--launcher.XXMaxPermSize) is not working with the new JDK (6u21, unless you are using the 6u21 build 7, see below).

Andrew Niefer确实提醒我注意这种情况,并写了一篇关于非标准 vm 参数 ( -XX:MaxPermSize)的博客文章,它可能导致其他供应商的vm根本无法启动。
但是该选项 ( --launcher.XXMaxPermSize)的 Eclipse 版本不适用于新的 JDK(6u21,除非您使用的是 6u21 build 7,见下文)。

The finalsolution is on the Eclipse Wiki, and for Helios on Windows with 6u21 pre build 7only:

最终的解决方案在Eclipse Wiki 上,仅适用于带有 6u21 pre build 7 的 Windows 上的 Helios

(eclipse_home)/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503

That's it. No setting to tweak here (again, only for Helios on Windowswith a 6u21 pre build 7).
For non-Windows platform, you need to revert to the Sun proprietary option -XX:MaxPermSize.

就是这样。此处无需调整设置(同样,仅适用带有6u21 预构建 7 的Windows上的Helios )。
对于非 Windows 平台,您需要恢复到 Sun 专有选项-XX:MaxPermSize

The issue is based one a regression: JVM identification fails due to Oracle rebranding in java.exe, and triggered bug 319514on Eclipse.
Andrew took care of Bug 320005 - [launcher] --launcher.XXMaxPermSize: isSunVMshould return true for Oracle, but that will be only for Helios 3.6.1.
Francis Upton, another Eclipse committer, reflects on the all situation.

该问题基于一个回归:JVM 识别因 java.exe 中的 Oracle 更名而失败,并在 Eclipse 上触发了错误 319514
Andrew 处理了错误 320005 - [launcher]--launcher.XXMaxPermSize: isSunVM应该为 Oracle 返回 true,但这仅适用于 Helios 3.6.1。另一位 Eclipse 提交者
Francis Upton反思了所有情况

Update u21b7, July, 27th:
Oracle have regressed the change for the next Java 6 release and won't implement it again until JDK 7.
If you use jdk6u21 build 7, you can revert to the --launcher.XXMaxPermSize(eclipse option) instead of -XX:MaxPermSize(the non-standard option).
The auto-detection happening in the C launcher shim eclipse.exewill still look for the "Sun Microsystems" string, but with 6u21b7, it will now work - again.

更新 u21b7,7 月 27 日
Oracle 已经为下一个 Java 6 版本回归了更改,并且在 JDK 7 之前不会再次实施它
如果您使用jdk6u21 build 7,您可以恢复到--launcher.XXMaxPermSize(eclipse 选项) 而不是-XX:MaxPermSize(非标准选项)。C 启动器 shim 中发生
自动检测eclipse.exe仍将查找 " Sun Microsystems" 字符串,但使用 6u21b7,它现在​​将再次工作。

For now, I still keep the -XX:MaxPermSizeversion (because I have no idea when everybody will launch eclipse the rightJDK).

现在,我仍然保留这个-XX:MaxPermSize版本(因为我不知道每个人什么时候会启动 eclipse正确的JDK)。



Implicit `-startup` and `--launcher.library`

隐式 `-startup` 和 `--launcher.library`

Contrary to the previous settings, the exact path for those modules is not set anymore, which is convenient since it can vary between different Eclipse 3.6.x releases:

与之前的设置相反,这些模块的确切路径不再设置,这很方便,因为它可以在不同的 Eclipse 3.6.x 版本之间变化:

  • startup: If not specified, the executable will look in the plugins directory for the org.eclipse.equinox.launcherbundle with the highest version.
  • launcher.library: If not specified, the executable looks in the pluginsdirectory for the appropriate org.eclipse.equinox.launcher.[platform]fragment with the highest version and uses the shared library named eclipse_*inside.
  • 启动:如果未指定,可执行文件将在插件目录中查找org.eclipse.equinox.launcher具有最高版本的包。
  • launcher.library:如果未指定,则可执行文件在plugins目录中查找org.eclipse.equinox.launcher.[platform]具有最高版本的相应片段,并使用eclipse_*内部命名的共享库。


Use JDK6

使用 JDK6

The JDK6 is now explicitly required to launch Eclipse:

现在明确要求 JDK6 来启动 Eclipse:

-Dosgi.requiredJavaVersion = 1.6

This SO questionreports a positive incidence for development on Mac OS.

这个SO 问题报告了在 Mac OS 上开发的积极影响。



+UnlockExperimentalVMOptions

+解锁实验性VM选项

The following options are part of some of the experimental options of the Sun JVM.

以下选项是 Sun JVM 的一些实验选项的一部分。

-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods

They have been reported in this blog postto potentially speed up Eclipse.
See all the JVM options hereand also in the official Java Hotspot options page.
Note: the detailed list of those optionsreports that UseFastAccessorMethodsmight be active by default.

这篇博客文章中已经报道了它们可能会加速 Eclipse。在此处以及官方Java 热点选项页面中
查看所有JVM 选项。 注意:这些选项详细列表报告默认情况下可能处于活动状态。
UseFastAccessorMethods

See also "Update your JVM":

另请参阅“更新您的 JVM”

As a reminder, G1 is the new garbage collector in preparation for the JDK 7, but already used in the version 6 release from u17.

提醒一下,G1 是为 JDK 7 准备的新垃圾收集器,但已经在 u17 的版本 6 中使用。



Opening files in Eclipse from the command line

从命令行在 Eclipse 中打开文件

See the blog postfrom Andrew Niefer reporting this new option:

请参阅Andrew Niefer的博客文章,报告此新选项:

--launcher.defaultAction
openFile

This tells the launcher that if it is called with a command line that only contains arguments that don't start with "-", then those arguments should be treated as if they followed "--launcher.openFile".

这告诉启动器,如果使用仅包含不以“ -”开头的参数的命令行调用它,则应将这些参数视为跟在“ --launcher.openFile”之后。

eclipse myFile.txt

This is the kind of command line the launcher will receive on windows when you double click a file that is associated with eclipse, or you select files and choose "Open With" or "Send To" Eclipse.

Relative pathswill be resolved first against the current working directory, and second against the eclipse program directory.

这是当您双击与 eclipse 关联的文件或选择文件并选择“ Open With”或“ Send To” Eclipse时,启动程序将在 Windows 上接收的命令行类型。

相对路径将首先针对当前工作目录进行解析,然后针对 eclipse 程序目录进行解析。

See bug 301033for reference. Originally bug 4922(October 2001, fixed 9 years later).

请参阅错误 301033以供参考。最初是错误 4922(2001 年 10 月,9 年后修复)。



p2 and the Unsigned Dialog Prompt

p2 和未签名的对话框提示

If you are tired of this dialog box during the installation of your many plugins:

如果您在安装许多插件时厌倦了这个对话框:

alt text

替代文字

, add in your eclipse.ini:

,添加您的eclipse.ini

-Declipse.p2.unsignedPolicy=allow

See this blog postfrom Chris Aniszczy, and the bug report 235526.

看到这个博客帖子克里斯Aniszczybug报告235526

I do want to say that security research supports the fact that less prompts are better.
People ignore things that pop up in the flow of something they want to get done.

For 3.6, we should not pop up warnings in the middle of the flow - no matter how much we simplify, people will just ignore them.
Instead, we should collect all the problems, do notinstall those bundles with problems, and instead bring the user back to a point in the workflow where they can fixup - add trust, configure security policy more loosely, etc. This is called 'safe staging'.

我确实想说安全研究支持这样一个事实,即提示越少越好。
人们会忽略在他们想要完成的事情流程中突然出现的事情。

对于 3.6,我们不应该在流程中间弹出警告——无论我们如何简化,人们都会忽略它们。
相反,我们应该收集所有的问题,都不会有问题的安装那些包,而是把在工作流中的用户返回到一个地步,他们可以修正内容-添加信任,配置安全策略更宽松,等等这就是所谓的“安全登台'

---------- http://www.eclipse.org/home/categories/images/wiki.gifalt text http://www.eclipse.org/home/categories/images/wiki.gifalt text http://www.eclipse.org/home/categories/images/wiki.gif

---------- http://www.eclipse.org/home/categories/images/wiki.gif替代文字 http://www.eclipse.org/home/categories/images/wiki.gif替代文字 http://www.eclipse.org/home/categories/images/wiki.gif

Additional options

其他选项

Those options are not directly in the eclipse.iniabove, but can come in handy if needed.

这些选项并不直接在eclipse.ini上面,但如果需要可以派上用场。



The `user.home` issue on Windows7

Windows7 上的 `user.home` 问题

When eclipse starts, it will read its keystore file (where passwords are kept), a file located in user.home.
If for some reason that user.homedoesn't resolve itself properly to a full-fledge path, Eclipse won't start.
Initially raised in this SO question, if you experience this, you need to redefine the keystore file to an explicit path (no more user.home to resolve at the start)

当 eclipse 启动时,它将读取其密钥库文件(保存密码的位置),该文件位于user.home.
如果由于某种原因user.home不能正确解析为完整路径,Eclipse 将不会启动。
最初在此 SO question 中提出,如果您遇到此问题,则需要将密钥库文件重新定义为显式路径(开始时不再需要解析 user.home)

Add in your eclipse.ini:

添加您的eclipse.ini

-eclipse.keyring 
C:\eclipse\keyring.txt

This has been tracked by bug 300577, it has been solve in this other SO question.

这已被错误 300577跟踪,已在另一个 SO 问题中解决。



Debug mode

调试模式

Wait, there's more than one setting file in Eclipse.
if you add to your eclipse.inithe option:

等等,Eclipse 中的设置文件不止一个。
如果您添加到您eclipse.ini的选项:

-debug

, you enable the debug modeand Eclipse will look for anothersetting file: a .optionsfile where you can specify some OSGI options.
And that is great when you are adding new plugins through the dropins folder.
Add in your .options file the following settings, as described in this blog post "Dropins diagnosis":

,您启用调试模式,Eclipse 将查找另一个设置文件:.options您可以在其中指定一些 OSGI 选项的文件。
当您通过 dropins 文件夹添加新插件时,这很棒。
在您的 .options 文件中添加以下设置,如这篇博客文章“ Dropins 诊断”中所述

org.eclipse.equinox.p2.core/debug=true
org.eclipse.equinox.p2.core/reconciler=true

P2 will inform you what bundles were found in dropins/folder, what request was generated, and what is the plan of installation. Maybe it is not detailed explanation of what actually happened, and what went wrong, but it should give you strong information about where to start:

  • was your bundle in the plan?
  • Was it installation problem (P2 fault)
  • or maybe it is just not optimal to include your feature?

P2 会通知您在dropins/文件夹中找到了哪些包,生成了哪些请求,以及安装计划是什么。也许它没有详细解释实际发生的事情以及出了什么问题,但它应该为您提供有关从哪里开始的强有力的信息:

  • 你的捆绑包在计划中吗?
  • 是不是安装问题(P2故障)
  • 或者也许包含您的功能不是最佳选择?

That comes from Bug 264924 - [reconciler] No diagnosis of dropins problems, which finally solves the following issue like:

那来自Bug 264924 - [reconciler] No diagnostic of dropins questions,最终解决了以下问题:

Unzip eclipse-SDK-3.5M5-win32.zip to ..../eclipse
Unzip mdt-ocl-SDK-1.3.0M5.zip to ..../eclipse/dropins/mdt-ocl-SDK-1.3.0M5

This is a problematic configuration since OCL depends on EMF which is missing.
3.5M5 provides no diagnosis of this problem.

Start eclipse.
No obvious problems. Nothing in Error Log.

  • Help / About / Plugindetails shows org.eclipse.ocl.doc, but not org.eclipse.ocl.
  • Help / About / Configurationdetails has no (diagnostic) mention of org.eclipse.ocl.
  • Help / Installation / Information Installed Softwarehas no mention of org.eclipse.ocl.

Where are the nice error markers?

这是一个有问题的配置,因为 OCL 依赖于缺少的 EMF。
3.5M5 没有提供此问题的诊断。

开始日食。
没有明显的问题。错误日志中没有任何内容。

  • Help / About / Plugin细节显示org.eclipse.ocl.doc,但不是org.eclipse.ocl
  • Help / About / Configuration详细信息没有(诊断)提及 org.eclipse.ocl.
  • Help / Installation / Information Installed Software没有提到org.eclipse.ocl

漂亮的错误标记在哪里?



Manifest Classpath

清单类路径

See this blog post:

请参阅此博客文章

  • In Galileo (aka Eclipse 3.5), JDT started resolving manifest classpath in libraries added to project's build path. This worked whether the library was added to project's build path directly or via a classpath container, such as the user library facility provided by JDT or one implemented by a third party.
  • In Helios, this behavior was changed to exclude classpath containers from manifest classpath resolution.
  • 在 Galileo(又名 Eclipse 3.5)中,JDT 开始解析添加到项目构建路径的库中的清单类路径。无论是将库直接添加到项目的构建路径还是通过类路径容器(例如 JDT 提供的用户库工具或第三方实现的用户库工具),这都有效。
  • 在 Helios 中,此行为已更改为从清单类路径解析中排除类路径容器。

That means some of your projects might no longer compile in Helios.
If you want to revert to Galileo behavior, add:

这意味着您的某些项目可能不再在 Helios 中编译。
如果您想恢复到伽利略行为,请添加:

-DresolveReferencedLibrariesForContainers=true

See bug 305037, bug 313965and bug 313890for references.

请参阅错误 305037错误 313965错误 313890以获取参考。



IPV4 stack

IPV4 堆栈

This SO questionmentions a potential fix when not accessing to plugin update sites:

这个SO 问题提到了不访问插件更新站点时的潜在修复:

-Djava.net.preferIPv4Stack=true

Mentioned here just in case it could help in your configuration.

在这里提到以防万一它可以帮助您的配置。



JVM1.7x64 potential optimizations

JVM1.7x64 潜在优化

This articlereports:

这篇文章报道:

For the record, the very fastest options I have found so far for my bench test with the 1.7 x64 JVM n Windows are:

作为记录,到目前为止,我在使用 1.7 x64 JVM n Windows 的基准测试中找到的最快选项是:

-Xincgc 
-XX:-DontCompileHugeMethods 
-XX:MaxInlineSize=1024  
-XX:FreqInlineSize=1024 

But I am still working on it...

但我还在努力……

回答by VonC

Eclipse Galileo 3.5 and 3.5.1 settings

Eclipse Galileo 3.5 和 3.5.1 设置

Currently (November 2009), I am testing with jdk6 update 17 the following configuration set of options (with Galileo -- eclipse 3.5.x, see below for 3.4or above for Helios 3.6.x):
(of course, adapt the relative paths present in this eclipse.ini to the correct paths for your setup)

目前(2009 年 11 月),我正在使用 jdk6 update 17 测试以下配置选项集(使用 Galileo -- eclipse 3.5.x,Helios 3.6.x 的3.4更高版本下文):(
当然,调整相对路径出现在此 eclipse.ini 中到您的设置的正确路径)

Note: for eclipse3.5, replace startupand launcher.librarylines by:

注意:对于eclipse3.5,将startuplauncher.library行替换为:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519

eclipse.ini 3.5.1

eclipse.ini 3.5.1

-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
../../../../program files/Java/jdk1.6.0_17/jre/bin/client/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins

See also my original answer abovefor more information.

另请参阅我上面的原始答案以获取更多信息。

Changes (from July 2009)

变化(从 2009 年 7 月开始)

  • refers to the launcher and not the framework
  • shared plugins: org.eclipse.equinox.p2.reconciler.dropins.directoryoption.
  • Galileo supports fully relative paths for workspace or VM (avoid having to modify those from one eclipse installation to another, if, of course, your JVM and workspace stay the same)
    Before, those relative paths kept being rewritten into absolute ones when eclipse launched itself...
  • You also can copy the JRE directory of a Java JDK installation inside your eclipse directory
  • 指的是启动器而不是框架
  • 共享插件:org.eclipse.equinox.p2.reconciler.dropins.directory选项。
  • Galileo 支持工作区或 VM 的完全相对路径(避免必须将那些从一个 Eclipse 安装修改为另一个,当然,如果您的 JVM 和工作区保持不变)
    之前,当 Eclipse 启动时,这些相对路径一直被重写为绝对路径...
  • 您还可以将 Java JDK 安装的 JRE 目录复制到 eclipse 目录中

Caveats

注意事项

There was a bug with ignored breakpointsactually related to the JDK.
Do use JDK6u16 or more recent for launchingeclipse (You can then define as many JDKs you want to compile withineclipse: it is not because you launch an eclipse with JDK6 that you will have to compile with that same JDK).

有一个错误,忽略了实际上与 JDK 相关的断点
务必使用 JDK6u16 或更新版本来启动eclipse(然后您可以定义要eclipse 中编译的任意数量的 JDK :这不是因为您使用 JDK6 启动 eclipse,因此您必须使用相同的 JDK 进行编译)。

Max

最大限度

Note the usage of:

注意以下用法:

--launcher.XXMaxPermSize
384m
-vmargs
-XX:MaxPermSize=128m

As documented in the Eclipse Wiki,

Eclipse Wiki 中所述

Eclipse 3.3 supports a new argument to the launcher: --launcher.XXMaxPermSize.
If the VM being used is a Sun VM and there is not already a -XX:MaxPermSize=VM argument, then the launcher will automatically add -XX:MaxPermSize=256mto the list of VM arguments being used.
The 3.3 launcher is only capable of identifying Sun VMs on Windows.

Eclipse 3.3 支持启动器的新参数:--launcher.XXMaxPermSize.
如果正在使用的 VM 是 Sun VM 并且还没有-XX:MaxPermSize=VM 参数,则启动器将自动添加-XX:MaxPermSize=256m到正在使用的 VM 参数列表中。
3.3 启动器只能识别 Windows 上的 Sun VM。

As detailed in this entry:

本条目所述

Not all vms accept the -XX:MaxPermSizeargument which is why it is passed in this manner. There may (or may not) exist problems with identifying sun vms.
Note: Eclipse 3.3.1 has a bugwhere the launcher cannot detect a Sun VM, and therefore does not use the correct PermGen size. It seems this may have been a known bug on Mac OS X for 3.3.0as well.
If you are using either of these platform combination, add the -XXflag to the eclipse.inias described above.

Notes:

  • the "384m" line translates to the "=384m" part of the VM argument, if the VM is case sensitive on the "m", then the so is this argument.
  • the "--launcher." prefix, this specifies that the argument is consumed by the launcher itself and was added to launcher specific arguments to avoid name collisions with application arguments. (Other examples are --launcher.library, --launcher.suppressErrors)

The -vmargs -XX:MaxPermSize=384mpart is the argument passed directly to the VM, bypassing the launcher entirely and no check on the VM vendor is used.

并非所有 vms 都接受这个-XX:MaxPermSize参数,这就是它以这种方式传递的原因。识别 sun vm 可能(也可能不)存在问题。
注意:Eclipse 3.3.1 有一个错误,即启动程序无法检测到 Sun VM,因此没有使用正确的 PermGen 大小。这似乎也是Mac OS X 3.3.0 上的一个已知错误
如果您正在使用这些平台组合中的任何一个,请按上述方式将-XX标志添加到eclipse.ini

笔记:

  • " 384m" 行转换为=384mVM 参数的 " " 部分,如果 VM 对 " m"区分大小写,则此参数也是如此。
  • " --launcher." 前缀,这指定参数由启动器本身使用并添加到启动器特定参数以避免与应用程序参数发生名称冲突。(其他例子是--launcher.library--launcher.suppressErrors

-vmargs -XX:MaxPermSize=384m部分是直接传递给 VM 的参数,完全绕过启动器并且不使用对 VM 供应商的检查。

回答by VonC

Eclipse Ganymede 3.4.2 settings

Eclipse Ganymede 3.4.2 设置



For more recent settings, see Eclipse Galileo 3.5 settings above.

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



JDK

JDK

The best JVM setting always, in my opinion, includes the latest JDK you can find(so for now, jdk1.6.0_b07 up to b16, except b14 and b15)

在我看来,最好的 JVM 设置始终包括您可以找到最新 JDK(因此目前,jdk1.6.0_b07 到 b16,b14 和 b15 除外

eclipse.ini

eclipse.ini

Even with those pretty low memory settings, I can run large java projects (along with a web server) on my old (2002) desktop with 2Go RAM.

即使内存设置非常低,我也可以在带有 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

See GKelly's SO answerand Piotr Gabryanczyk's blog entryfor more details about the new options.

有关新选项的更多详细信息,请参阅GKelly 的 SO 答案Piotr Gabryanczyk 的博客条目

Monitoring

监控

You can also consider launching:

您还可以考虑启动:

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

As said in a previous question about memory consumption.

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

回答by Mikko Rantalainen

Eclipse Indigo 3.7.2 settings (64 bit linux)

Eclipse Indigo 3.7.2 设置(64 位 linux)

Settings for Sun/Oracle javaversion "1.6.0_31" and Eclipse 3.7running on x86-64 Linux:

对于设置的Sun /甲骨文的Java版本“1.6.0_31”和Eclipse的3.7上的x86-64运行Linux:

-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

Note that this uses only 200 MB for the heap and 150 MB for the non-heap. If you're using huge plugins, you might want to increase both the "-Xmx200m" and "-XX:MaxPermSize=150m" limits.

请注意,这仅将 200 MB 用于堆,150 MB 用于非堆。如果您使用大型插件,您可能需要同时增加“-Xmx200m”和“-XX:MaxPermSize=150m”限制。

The primary optimization target for these flags has been to minimize latency in all casesand as a secondary optimization target minimize the memory usage.

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

回答by Stephen Denne

-showlocation

-显示位置

To make it easier to have eclipse running twice, and know which workspace you're dealing with

为了更容易让 Eclipse 运行两次,并知道您正在处理哪个工作区

Eclipse 3.6 adds a preferences option to specify what to show for the Workspace name (shown in window title)which works much better than -showlocationfor three reasons:

Eclipse 3.6 添加了一个首选项选项来指定要显示的内容,Workspace name (shown in window title)这比-showlocation以下三个原因要好得多:

  1. You do not need to restart eclipse for it to take affect.
  2. You can chose a short code.
  3. It appears first, before the perspective and application name.
  1. 您无需重新启动 eclipse 即可生效。
  2. 您可以选择一个短代码。
  3. 它首先出现在透视图和应用程序名称之前。

回答by Gilberto Olimpio

If you are using Linux + Sun JDK/JRE 32bits, change the "-vm" to:

如果您使用的是 Linux + Sun JDK/JRE 32bits,请将“-vm”更改为:

-vm 
[your_jdk_folder]/jre/lib/i386/client/libjvm.so

If you are using Linux + Sun JDK/JRE 64bits, change the "-vm" to:

如果您使用的是 Linux + Sun JDK/JRE 64bits,请将“-vm”更改为:

-vm
[your_jdk_folder]/jre/lib/amd64/server/libjvm.so

That's working fine for me on Ubuntu 8.10 and 9.04

这对我来说在 Ubuntu 8.10 和 9.04 上运行良好

回答by Ben W.

If you're going with jdk6 update 14, I'd suggest using using the G1 garbage collector which seems to help performance.

如果您要使用 jdk6 update 14,我建议您使用 G1 垃圾收集器,这似乎有助于提高性能。

To do so, remove these settings:

为此,请删除以下设置:

-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing

-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing

and replace them with these:

并用这些替换它们:

-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC

-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC

回答by Kire Haglin

You can also try running with JRockit. It's a JVM optimized for servers, but many long running client applications, like IDE's, run very well on JRockit. Eclipse is no exception. JRockit doesn't have a perm-space so you don't need to configure it.

您也可以尝试使用JRockit运行。它是针对服务器优化的 JVM,但许多长期运行的客户端应用程序(如 IDE)在 JRockit 上运行良好。Eclipse 也不例外。JRockit 没有永久空间,因此您无需对其进行配置。

It's possible set a pause time target(ms) to avoid long gc pauses stalling the UI.

可以设置一个暂停时间目标(毫秒)以避免长时间的 gc 暂停拖延 UI。

-showsplash
org.eclipse.platform
-vm
 C:\jrmc-3.1.2-1.6.0\bin\javaw.exe 
-vmargs
-XgcPrio:deterministic
-XpauseTarget:20

I usually don't bother setting -Xmx and -Xms and let JRockit grow the heap as it sees necessary. If you launch your Eclipse application with JRockit you can also monitor, profile and find memory leaks in your application using the JRockit Mission Control tools suite. You download the plugins from this update site. Note, only works for Eclipse 3.3 and Eclipse 3.4

我通常不会设置 -Xmx 和 -Xms 并让 JRockit 在它认为必要时增加堆。如果您使用 JRockit 启动您的 Eclipse 应用程序,您还可以使用 JRockit Mission Control 工具套件监视、分析和查找应用程序中的内存泄漏。您可以从此更新站点下载插件。注意,仅适用于 Eclipse 3.3 和 Eclipse 3.4

回答by CurlyBrackets

Here's my own setting for my Eclipse running on i7 2630M 16GB RAM laptop, this setting has been using for a week, without a single crashing, and Eclipse 3.7 is running smoothly.

这是我自己的 Eclipse 在 i7 2630M 16GB RAM 笔记本电脑上运行的设置,这个设置已经使用了一周,没有发生一次崩溃,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

Calculations: For Win 7 x64

计算:对于 Win 7 x64

  • Xms = Physical Memory / 16
  • Xmx = Physical Memory / 4
  • MaxPermSize = Same as default value, which is 256m
  • Xms = 物理内存 / 16
  • Xmx = 物理内存 / 4
  • MaxPermSize = 与默认值相同,即 256m

回答by A Null Pointer

-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dcom.sun.management.jmxremote
-Declipse.p2.unsignedPolicy=allow

And these setting have worked like a charm for me. I am running OS X10.6 , Eclipse 3.7 Indigo , JDK1.6.0_24

这些设置对我来说就像一种魅力。我正在运行 OS X10.6、Eclipse 3.7 Indigo、JDK1.6.0_24