Andrew L
Andrew L

Reputation: 283

Eclipse not increasing VM heap size as specified in .ini

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

Upvotes: 3

Views: 986

Answers (4)

Vinodh
Vinodh

Reputation: 1

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.

Upvotes: 0

greg-449
greg-449

Reputation: 111142

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.

Upvotes: 2

Karthigeyan Vellasamy
Karthigeyan Vellasamy

Reputation: 2066

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

Upvotes: 1

m.aibin
m.aibin

Reputation: 3593

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.

Upvotes: 0

Related Questions