3

Can someone help me out with this. I just simply cannot get the VM to increase beyond 1.8GB or some reason. This utility returns 64 and 1883242496 when run in Eclipse but returns the correct values when run from the command line (java.exe). The VM is 64 bits so should go past 1.8 GB.

 public static void main(String[] args) {
        System.out.println(System.getProperty("sun.arch.data.model"));
        System.out.println(java.lang.Runtime.getRuntime().maxMemory());
    }

Eclipse.ini contents below. Tried just about everything.

-startup    
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar

--launcher.library    
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M    
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk1.8.0_66\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms6144m
-Xmx6144m
-d64

Thanks in advance

Andrew L
  • 243
  • 1
  • 11
  • Possible duplicate http://stackoverflow.com/questions/14382932/increase-jvm-max-heap-size-for-eclipse – Karthigeyan Vellasamy Dec 14 '15 at 06:51
  • This is not a duplicate because none of those answers in that thread worked for me. That's where I started my research. Answer 2 below I've tested and works. – Andrew L Dec 20 '15 at 06:45

4 Answers4

2

The configuration in eclipse.ini sets the memory used by Eclipse itself, it does not change the memory used when you run a program from within Eclipse.

You can change the setting for a particular program by opening 'Run > Run Configurations' and selecting your program in the 'Java Applications' section and add your arguments to the 'VM arguments'. enter image description here

You can also set the default as shown in another answer.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • Used this option and it worked fine, but only set the Xmx. Had some issues when setting the Xms, where one project would not run. – Andrew L Dec 20 '15 at 06:38
1

Even by setting both to same heap size 6144m

-Dosgi.requiredJavaVersion=1.7 -Xmx6144m -Xmx6144m

in eclipse.ini is not increasing the heap size for 64 sit but by passing argument for JVM using windows--> preference we can increase the heap size

enter image description here

enter image description here

Karthigeyan Vellasamy
  • 2,038
  • 6
  • 33
  • 50
0

You can try this:

-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
6144m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms6144m
-Xmx6144m
-XX:+UseParallelGC
-XX:PermSize=6144M
-XX:MaxPermSize=6144M
-d64

Hope it will help.

m.aibin
  • 3,528
  • 4
  • 28
  • 47
0

I recently had a problem with loading projects in an eclipse program. The error was related to garbage collection (GC).

When searching for a solution online, I noticed this is due to the memory allocation. In Eclipse, as you may know, the ini file could be used to allocate minimum and maximum memory allocated to the program.

-Xms  Initial memory size 
-Xmx  maximum memory size

When the value of –Xmx was changed to higher value 2048m, I expected the program to load all the projects without any problem. But, I could see the same error.

When I looked into little further, there was a system variable _JAVA_OPTIONS with value -Xmx512M. This had overwritten the values in the ini file.

Reflection:
It is worth to also look into the system variables when the program does not reflect the values in the ini files.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Vinodh
  • 1