How to reduce Eclipse's memory usage?

Eclipse

Eclipse Problem Overview


The memory usage of Eclipse 3.4 is through the roof to the point where it's becoming an issue.

I have a simple BlackBerry project loaded and the usage skyrockets to nearly 400 MB, sometimes higher. Is there something that can be done to bring it down?

Eclipse Solutions


Solution 1 - Eclipse

Eclipse 3.4 can consume a lot more memory than the previous versions, courtesy the spellchecker plug-in.

You can switch off the plug-in by going to Window -> Preferences -> General -> Editors -> Text Editors -> Spelling, and unchecking the box title 'Enable spell checking'.

Of course, the tips offered to use larger heap sizes and better garbage collectors would do you good as well.

Solution 2 - Eclipse

Checking General -> Show heap status will enable this

Eclipse heap status bar

in the bottom bar. This way you can manually run the garbage collector whenever you want by clicking on the trash can. It's not a fix, more like a workaround, but it helped reduce massively my RAM / CPU usage.

Solution 3 - Eclipse

Remove +UseG1GC option from eclipse.ini. I've read from here that It is only used for araound 6GB heap memory.

Solution 4 - Eclipse

In Eclipse Luna 4.4.1 Was trying to cut my memory usage in Eclipse. I managed to shave mine from 600mb to 300mb. I did the following:

  • Turned off the plugins activated on startup that I wasn't using. Windows > Preferences > General > Startup and Shutdown

  • Closed projects I wasn't working on at the time.

Found the hints/tips here : http://blog.elijaa.org/2010/09/20/tricks-to-speed-up-eclipse-php-helios-pdt-2-2/

Solution 5 - Eclipse

Modern versions of Eclipse do need quite a bit of RAM to do their thing. But should still run pretty fast on any modern machine.

Assuming you have enough physical memory (2GB is fine unless you have lots of other processes running, or you're using RAD), see this article on Eclipse's memory usage for some tips on tweaking the settings. The two most common culprits are Xmx and/or MaxPermSize being set too low (Xmx defaults to 256M and MaxPermSize defaults to 64M).

You modify the values by passing command line arguments or tweaking the eclipse.ini in the Eclipse install location.

You should end up with something like this:

...
-vmargs
-Xms128m
-Xmx1024m 
-XX:MaxPermSize=128m

Solution 6 - Eclipse

While you probably could tinker with the configuration, removing various plugins etc, it's likely to be more cost effective to buy more memory. How much do you currently have? I would consider a developer machine with less than 2GB of memory to be under spec, and I suspect many people would double that...

Solution 7 - Eclipse

My Eclipse is taking over 800MB resident, and 2GB virtual (part of it swapped out perhaps). Java can be a hog, it's giving Java bad press all the time.

However, there is a little something that many people don't know: the incremental garbage collector. -Xincgc The side effect is that it hands memory back to the system from time to time. By default Java just takes and takes, and when it doesn't need memory anymore, it keeps it for itself. The incgc is a different strategy where it becomes more reasonable to assume that memory can be handed back the system without running into trouble. This can however affect performance.

There are many garbage collection settings. You can also have multiple threads handle GC. The parallel GC does that. Not sure if that one hands memory back, don't think so.

Solution 8 - Eclipse

If 400 Mb of RAM is a big issue for you, you might want to try another IDE. Eclipse stores a lot of state information, some or most of which you don't actually need. That's a design choice.

Right now, I have the same project open in both Eclipse and QtCreator: after a clean rebuild, Eclipse uses 156 Mb RAM, Qt Creator is happy with 66 Mb.

Solution 9 - Eclipse

You can try the 64bit version of Eclipse with the 64bit version of JDK on Windows 7. Those both caused some odd issues with the 3rd party Framework I have to work with. The 32-bit of JRockit (free now) from Oracle seems to be faster and be a little better on memory. This is my Eclipse.ini settings:

This is my eclipse inn

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-nosplash
org.eclipse.platform
--launcher.XXPermSize
512m
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-vm
C:/Program Files (x86)/Java/jrockit-jdk1.6.0_31-R28.2.3-4.1.0/jre/bin
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xquickstart
-XX:+AggressiveHeap
-XX:+AggressiveOpts
-XX:+UseParallelOldGC
-XX:ParallelGCThreads=2
-XX:ThreadPriorityPolicy=1
-Xverify:none
-Xms1100m
-Xmx1100m

I switched to the 32 bit JRockit JDK which seems a little faster for Eclipse. I turn off and don't install more than I need. For each separate type of app development (Android, J2EE, just Spring, ...) I have different Eclipse installations. Hard drive space is cheap. Then I can have just the plugins I need for each one. I would never want all the Android tools loading if I wasn't using them. STS is also good for just the Spring stuff and I have one just for OpenShift Cloud work.

Solution 10 - Eclipse

Try disabling your eclipse plugins. Eclipse was hogging half of my of my memory when I had the saros plugin open.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAngryHackerView Question on Stackoverflow
Solution 1 - EclipseVineet ReynoldsView Answer on Stackoverflow
Solution 2 - EclipsemaawView Answer on Stackoverflow
Solution 3 - EclipseEbru YenerView Answer on Stackoverflow
Solution 4 - EclipseMarkView Answer on Stackoverflow
Solution 5 - EclipseRich SellerView Answer on Stackoverflow
Solution 6 - EclipseJon SkeetView Answer on Stackoverflow
Solution 7 - EclipseMikeView Answer on Stackoverflow
Solution 8 - EclipseGyörgy AndrasekView Answer on Stackoverflow
Solution 9 - EclipseTim SpannView Answer on Stackoverflow
Solution 10 - EclipsegoogooView Answer on Stackoverflow