0

I have tried increasing my java heap memory by adding -Xms10g and -Xmx12g to my eclipse.ini file (My RAM is 16GB, and I know 10G is too much but I just wanted to make sure that's not what's causing the issue). Eclipse seems to have absorbed that because the memory usage bar in bottom right corner reflects that change:

enter image description here

edit: (I added -Xms8g -Xmx10g in the run config too. The results remained the same. Read along.)

However, when I run something on eclipse, as soon as it reaches around 4GB of memory it gives me a java.lang.OutOfMemoryError: Java heap space error. Moreover, when I look at memory usage in VisualVM, I see a "Max" above the graph that says 4,294MB.

enter image description here

I also tried getting my actual max memory limit using terminal, and if I did it correctly, looks like it's really set to 4.294GB:

enter image description here

Can someone tell me why I can't get to memory usages above 4.294GB? What should I change other than eclipse.ini? (I've also tried adding -Xmx8g as a runtime parameter in my JRE settings but no luck.)

P.S: Here is the full content of the eclipse.ini file per a user's request:

-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.instance.area.default=@user.home/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
Roozbehan
  • 478
  • 5
  • 15
  • I added it as a P.S. – Roozbehan Oct 23 '20 at 20:30
  • The eclipse.ini settings only apply to Eclipse itself. For programs you run from within Eclipse the settings are in the Run Configuration for the program (Run > Run Configurations...) – greg-449 Oct 23 '20 at 20:35
  • @Roozbehan - You have unnecessarily set too much memory for eclipse. The setting of `-Xms256m -Xmx1024m` would be enough for eclipse. You need to set the memory for the application you are running from eclipse. – Arvind Kumar Avinash Oct 23 '20 at 20:40
  • Forgot to mention. But I added ```-Xms8g -Xmx10g``` in the run config too and yet I get exactly the same results. – Roozbehan Oct 23 '20 at 20:42
  • Looks like someone has already maked the question as duplicate without even making sure first :( – Roozbehan Oct 23 '20 at 20:45

0 Answers0