101

I have following setup, but when I put 1024 and replace all 512 with 1024, then eclipse won't start at all. How can I have more than 512M memory for my eclipse JVM?

-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
com.springsource.sts.ide
--launcher.XXMaxPermSize
512M
-vm
C:\Program Files (x86)\Java\jdk1.6.0_18\bin\javaw 
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx512m
-XX:MaxPermSize=512m
newbie
  • 24,286
  • 80
  • 201
  • 301
  • After trying one of the answers here, how to check how much is Eclipse taking? (e.g. you may have edited the wrong eclipse.ini file) – golimar May 04 '21 at 15:41

7 Answers7

122

I've had a lot of problems trying to get Eclipse to accept as much memory as I'd like it to be able to use (between 2 and 4 gigs for example).

Open eclipse.ini in the Eclipse installation directory. You should be able to change the memory sizes after -vmargs up to 1024 without a problem up to some maximum value that's dependent on your system. Here's that section on my Linux box:

-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=512m
-Xms512m
-Xmx1024m

And here's that section on my Windows box:

-vmargs
-Xms256m
-Xmx1024m

But, I've failed at setting it higher than 1024 megs. If anybody knows how to make that work, I'd love to know.

EDIT: 32bit version of juno seems to not accept more than Xmx1024m where the 64 bit version accept 2048.

EDIT: Nick's post contains some great links that explain two different things:

  • The problem is largely dependent on your system and the amount of contiguous free memory available, and
  • By using javaw.exe (on Windows), you may be able to get a larger allocated block of memory.

I have 8 gigs of Ram and can't set -Xmx to more than 1024 megs of ram, even when a minimal amount of programs are loaded and both windows/linux report between 4 and 5 gigs of free ram.

Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
Kaleb Pederson
  • 45,767
  • 19
  • 102
  • 147
  • 6
    Where do you put in this info? – CodyBugstein Aug 20 '13 at 01:47
  • 6
    @Imray, you'll need to add (or replace) these settings to your `eclipse.ini` file. The location depends on your platform. For Windows, it's located in the same folder as the Eclipse app. For OS X, you'll need to "Show Package Contents" on the Eclipse app, then edit Contents/MacOS/eclipse.ini in a text editor. Not sure about Linux... exercise left to the reader? :-) – sherb Aug 29 '13 at 19:15
  • 6
    It's helpful to know the meaning of the options: all -X options after -vmargs are passed directly to the JVM, so run 'java -X' to get documentation. -Xms sets the initial heap, and -Xmx sets the maximum size the heap can grow to. PermSize is the area where class/method objects are stored, separate from the heap. – jfritz42 Mar 14 '14 at 18:59
  • Please note that -XX:MaxPermSize=512m doesn't need to be set for Java 8. See http://stackoverflow.com/questions/18339707/permgen-elimination-in-jdk-8. – Paul Jansen Aug 10 '15 at 19:35
  • 1
    Here is where elcipse.ini may be located in Linux or Ubuntu http://stackoverflow.com/a/14898134/457687 – Vlad Aug 15 '16 at 19:38
  • "eclipse.ini" on Linux can be found using the command `cd / && sudo find | grep "eclipse.ini"` – Fish11 Oct 12 '18 at 22:07
38

Here is how i increased the memory allocation of eclipse Juno:

enter image description here

I have a total of 4GB on my system and when im working on eclipse, i dont run any other heavy softwares along side it. So I allocated 2Gb.

The thing i noticed is that the difference between min and max values should be of 512. The next value should be let say 2048 min + 512 = 2560max

Here is the heap value inside eclipse after setting -Xms2048m -Xmx2560m:

enter image description here

Jake Toronto
  • 3,524
  • 2
  • 23
  • 27
Ibn Saeed
  • 3,171
  • 11
  • 50
  • 59
6

Care and feeding of Eclipse's memory hunger is a pain...

More or less, keep trying smaller amounts til it works, that's your max.

Nick Veys
  • 23,458
  • 4
  • 47
  • 64
4

You can copy this to your eclipse.ini file to have 1024M:

-clean -showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms512m
-Xmx1024m
-XX:PermSize=128m
-XX:MaxPermSize=256m 
Aaron
  • 55,518
  • 11
  • 116
  • 132
GuruKulki
  • 25,776
  • 50
  • 140
  • 201
4

I don't think you need to change the MaxPermSize to 1024m. This works for me:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms256m
-Xmx1024m
-XX:PermSize=64m
-XX:MaxPermSize=128m
elduff
  • 1,178
  • 3
  • 14
  • 22
  • 8
    um ... could we all get some comments along with the downvotes, please? My answer may not be correct, but it'd help me to know why. – elduff Apr 09 '10 at 20:09
1

While working on an enterprise project in STS (heavily Eclipse based) I was crashing constantly and STS plateaued at around 1GB of RAM usage. I couldn't add new .war files to my local tomcat server and after deleting the tomcat folder to re-add it, found I couldn't re-add it either. Essentially almost anything that required a new popup besides the main menus was causing STS to freeze up.

I edited the STS.ini (your Eclipse.ini can be configured similarly) to:

--launcher.XXMaxPermSize 1024M -vmargs -Xms1536m -Xmx2048m -XX:MaxPermSize=1024m

Rebooted STS immediately and saw it plateau at about 1.5 gigs before finally not crashing

fIwJlxSzApHEZIl
  • 11,861
  • 6
  • 62
  • 71
1

Configuring this worked for me: -vmargs -Xms1536m -Xmx2048m -XX:MaxPermSize=1024m on Eclipse Java Photon June 2018

Running Windows 10, 8 GB ram and 64 bit. You can extend -Xmx2048 -XX:MaxpermSize= 1024m to 4096m too, if your computer has good ram.Mine worked well.

Skidrow
  • 11
  • 2