增加 Eclipse 的 JVM 最大堆大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14382932/
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 21:31:09  来源:igfitidea点击:

Increase JVM max heap size for Eclipse

eclipsejvmheap

提问by Inigo Llamosas

I am trying to increase the max heap size for my Eclipse. I have tried specifying in eclipse.inior through the command line, but are not working.

我正在尝试增加 Eclipse 的最大堆大小。我曾尝试在eclipse.ini命令行中或通过命令行指定,但没有工作。

My max heap size has the exact same limit before (running jconsole) and after (System.out.println(java.lang.Runtime.getRuntime().maxMemory());) starting Eclipse. 1.8G

System.out.println(java.lang.Runtime.getRuntime().maxMemory());启动 Eclipse之前(运行 jconsole)和之后(),我的最大堆大小具有完全相同的限制。1.8G

  1. Is there any way to modify JVM heap size before it is launched (ex. a config file?)
  2. What could I be doing wrong when specifying heap size to Eclipse?
  1. 有没有办法在启动之前修改 JVM 堆大小(例如配置文件?)
  2. 为 Eclipse 指定堆大小时,我可能做错了什么?

This is the command:

这是命令:

./eclipse/eclipse -debug -consoleLog -vmargs -Xms1000m -Xmx6000m -XX:-UseGCOverheadLimitcl

This is my eclipse.ini(which values are overwritten by the specified eclipse launching parameters):

这是我的eclipse.ini(哪些值被指定的 eclipse 启动参数覆盖):

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120522-1813
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Dhelp.lucene.tokenizer=standard
-XX:MaxPermSize=6000m
-Xms1000m
-Xmx6000m

回答by slashdot

It is possible to increase heap size allocated by the Java Virtual Machine (JVM) by using command line options.

可以使用命令行选项增加 Java 虚拟机 (JVM) 分配的堆大小。

-Xms<size>        set initial Java heap size
-Xmx<size>        set maximum Java heap size
-Xss<size>        set java thread stack size

If you are using the tomcat server, you can change the heap size by going to Eclipse/Run/Run Configuration and select Apache Tomcat/your_server_name/Arguments and under VM arguments section use the following:

如果您使用的是 tomcat 服务器,您可以通过转到 Eclipse/Run/Run Configuration 并选择 Apache Tomcat/your_server_name/Arguments 并在 VM arguments 部分下使用以下内容来更改堆大小:

-XX:MaxPermSize=256m
-Xms256m -Xmx512M

If you are not using any server, you can type the following on the command line before you run your code:

如果您没有使用任何服务器,则可以在运行代码之前在命令行中键入以下内容:

java -Xms64m -Xmx256m HelloWorld

More information on increasing the heap size can be found here

可以在此处找到有关增加堆大小的更多信息

回答by Bourkadi

You can use this configuration:

您可以使用此配置:

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xms512m
-Xmx1024m
-XX:+UseParallelGC
-XX:PermSize=256M
-XX:MaxPermSize=512M

回答by Ale?

Try to modify the eclipse.iniso that both Xmsand Xmxare of the same value:

尝试修改 ,eclipse.ini使XmsXmx具有相同的值:

-Xms6000m
-Xmx6000m

This should force the Eclipse's VM to allocate 6GBof heap right from the beginning.

这应该会强制 Eclipse 的 VM6GB从一开始就分配堆。

But be careful about either using the eclipse.inior the command-line ./eclipse/eclipse -vmargs .... It should work in both cases but pick one and try to stick with it.

但是要小心使用eclipse.ini或 命令行./eclipse/eclipse -vmargs ...。它应该适用于两种情况,但选择一种并尝试坚持下去。

回答by Luke

--launcher.XXMaxPermSize

--launcher.XXMaxPermSize

256m

256m

Try to bump that value up!

尝试提高该值!