了解 Eclipse 的内存参数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12864732/
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
Understanding memory parameters for Eclipse
提问by Josh
I just installed Eclipse 4.2(Juno) on Linux 64 bit. I have looked at several Eclipse.ini
threads on Stack Overflow, but I still don't understand the relationship between the different memory parameters.
我刚刚在 Linux 64 位上安装了Eclipse 4.2(Juno)。我Eclipse.ini
在Stack Overflow上查看了几个线程,但我仍然不明白不同内存参数之间的关系。
On one hand, there are parameters that are for the VMand that go under -vmargs
(for example, -Xms
and -Xmx
, -XX
), while others (for example, --launcher.XXMaxPermSize
) are provided to Eclipse directly.
一方面,有些参数是用于VM 的,并且属于-vmargs
(例如,-Xms
和-Xmx
,-XX
),而其他参数(例如,--launcher.XXMaxPermSize
)则直接提供给 Eclipse。
What is the relationship between these parameters? How would I set them up for a machine with more than 8 GB of memory?
这些参数之间有什么关系?我将如何为内存超过 8 GB 的机器设置它们?
I am aware of the long Stack Overflow question What are the best JVM settings for Eclipse?, but I would like to learnhow to adjust these parameters myself.
我知道很长的堆栈溢出问题Eclipse 的最佳 JVM 设置是什么?,但我想学习如何自己调整这些参数。
For reference, after installation, the default parameters that Juno has are:
供参考,安装后,Juno 的默认参数为:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Dhelp.lucene.tokenizer=standard
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
采纳答案by Konstantin Komissarchik
If you are running Eclipse on an Oracle/Sun JVM, I would disregard --launcher.XXMaxPermSize
(I personally remove it) and concentrate on -XX:MaxPermSize
, -Xms
and -Xmx
.
如果您在 Oracle/Sun JVM 上运行 Eclipse,我会忽略--launcher.XXMaxPermSize
(我个人将其删除)并专注于-XX:MaxPermSize
,-Xms
和-Xmx
。
The reason for --launcher.XXMaxPermSize
is that some non-Oracle/Sun JVMs would choke on -XX:MaxPermSize
. The launcher is programmed to detect the JVM and conditionally supply -XX:MaxPermSize
. This of course is defeated by the explicit -XX:MaxPermSize
setting in the default eclipse.inifile. That looks like a bug.
原因--launcher.XXMaxPermSize
是某些非 Oracle/Sun JVM 会阻塞-XX:MaxPermSize
. 启动器被编程为检测 JVM 并有条件地提供-XX:MaxPermSize
. 这当然会被-XX:MaxPermSize
默认eclipse.ini文件中的显式设置所破坏。这看起来像一个错误。
I never mess with -Xms
setting. I set -Xmx1024m
and -XX:MaxPermSize=512m
.
我从不乱-Xms
设置。我设置-Xmx1024m
和-XX:MaxPermSize=512m
。
回答by Yosh
For the sake of completeness, it should be noted that the permanent generation (PermGen) was replaced with MetaSpace in Java 8 HotSpot.
为了完整起见,需要注意的是永久代(PermGen)在 Java 8 HotSpot 中被 MetaSpace 取代。
So, if you're using an Oracle JVM with Java 8 or higher you don't have to worry about these parameters anymore and can safely remove those from you eclipse.ini:
因此,如果您使用带有 Java 8 或更高版本的 Oracle JVM,您不必再担心这些参数,并且可以安全地从 eclipse.ini 中删除这些参数:
--launcher.XXMaxPermSize
-XX:MaxPermSize
Since then the -XX:MaxPermSize
parameter is ignored by the JVM and generates a warning (See: PermGen elimination in JDK 8).
此后该-XX:MaxPermSize
参数被 JVM 忽略并生成警告(请参阅:JDK 8 中的 PermGen 消除)。