使用xmx增加jvm内存不会增加我的限制

问题描述

我尝试通过将-xms10g-Xmx12g添加到我的eclipse.ini文件中来增加我的Java堆内存(我的RAM是16GB,我知道10G太多了,但是我只是想确保不是引起问题的原因)。 Eclipse似乎吸收了这一点,因为右下角的内存使用情况栏反映了这一变化:

enter image description here

编辑 :(我也在运行配置中添加-xms8g -Xmx10g。结果保持不变。请继续阅读。)

但是,当我在eclipse上运行某些内容时,一旦它达到4GB的内存,就会给我一个java.lang.OutOfMemoryError: Java heap space错误。此外,当我查看VisualVM中的内存使用情况时,在图形上方看到一个“最大值”,表示4,294MB。

enter image description here

我还尝试使用终端获取我的实际最大内存限制,如果正确执行,看起来它确实设置为4.294GB:

enter image description here

有人可以告诉我为什么我无法使用4.294GB以上的内存吗?除了eclipse.ini之外,我还应该更改什么? (我还尝试过在我的JRE设置中添加-Xmx8g作为运行时参数,但是没有运气。)

P.S:这是根据用户请求的eclipse.ini文件的完整内容

-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.1300.v20200819-0940
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi[email protected]/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYstem
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitinit=true
-xms10g
-Xmx12g
--add-modules=ALL-SYstem
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)