88

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?

AngryHacker
  • 59,598
  • 102
  • 325
  • 594
  • 7
    Looking back on this question now, I'd have to say that I'd be delighted if I could get my eclipse memory usage down to 400MB. Right now I'm struggling to get it down to 1GB (plus another 300MB if you include a copy of Tomcat for actually running my projects...). – Jules Sep 07 '17 at 14:12
  • 7
    I am writing this comment from the future (2018) and Eclipse is taking 10 GB on my current project. – Benjamin Barrois Mar 23 '18 at 14:36
  • 2
    I just got back from year 2030 and Eclipse is taking up 5 terabytes before loading a project. – AngryHacker Sep 11 '20 at 17:16

10 Answers10

93

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.

Vineet Reynolds
  • 76,006
  • 17
  • 150
  • 174
  • 14
    Didn't work for me. Still at 900-930MB. I mean wtf could it be doing. – TheRealChx101 Nov 13 '14 at 18:00
  • 9
    Great answer. 1 plug-in down, about 50 others that I've never heard of/never use to go. (Note to self, start using IntelliJ) – 8bitjunkie Nov 18 '15 at 12:39
  • 11
    2016 and still facing this issue. I mean 1GB of my Ram space is occupied by eclipse. Turning off the spell checker plugin din't help either. – Lucky Apr 06 '16 at 12:24
  • 14
    2017 and my Eclipse is now using 1.7GB of RAM with almost no additional plugins. There has to be an end to this madness. – Storm Jun 19 '17 at 13:22
  • This was very usefull advice thank you. I've been working on large LATEX / R documents, with lots of text and unchecking Enable spelling has reduced heap size a lot ! – Cedric Sep 03 '21 at 12:01
  • Thanks man. this is the exact issue i was facing. – deepaksingh pawar Sep 15 '21 at 12:22
  • Well, macos, after 2-3 days of Eclipse used... friken 5.2GB. Restart lowers it to 1.8GB... but i mean... still... what is it doing? – Andrei F May 05 '23 at 14:29
25

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.

maaw
  • 1,276
  • 13
  • 13
  • 2
    This helped me identify that the allocated 4GB of RAM to eclipse, was not in fact being used, even though the OS showed that 4GB was in use. I reduced the amount of RAM allocated to eclipse to help free up RAM for other applications. – Navigatron Jul 11 '17 at 12:46
  • 1
    As Sping Tool Suit derived from eclipse So this also work with STS – Talib Hussain Mar 04 '20 at 14:21
13

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

Ebru Yener
  • 674
  • 6
  • 17
11

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/

Matthieu
  • 2,736
  • 4
  • 57
  • 87
Mark
  • 2,423
  • 4
  • 24
  • 40
9

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
patstuart
  • 1,931
  • 1
  • 19
  • 29
Rich Seller
  • 83,208
  • 23
  • 172
  • 177
8

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...

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • 4
    Couldn't agree more. 1GB of RAM is as little as $20-30. How much is your time worth? Getting a collection of plugins to work in Eclipse is hard work enough without fidding with it (arguably) unnecessarily. – cletus Sep 29 '09 at 06:07
  • 2
    I am maxed out at 2GB (it's an old laptop). The problem is that once the BlackBerry simulator is loaded, Visual Studio (web services) and Chrome (to look stuff up on the web), the laptop comes to a crawl. But Eclipse is by far the biggest offender. It was not so bad with the 3.3 or the 3.2 versions. – AngryHacker Sep 29 '09 at 06:10
  • If Eclipse is the biggest offender at 400MB and you've got 2GB, you shouldn't be running *that* short on memory. Is it definitely memory that's the problem here? Are you swapping? – Jon Skeet Sep 29 '09 at 06:13
  • Basically, the moment Commit Charge total comes within 200-300 MB of the Total Physical Memory, the laptop starts swapping. Noticed a question about peeps complaining of the same this: http://stackoverflow.com/questions/100161/is-eclipse-3-4-ganymede-memory-usage-significantly-higher-than-3-2 – AngryHacker Sep 29 '09 at 06:18
  • The moment I kill Eclipse, the laptop comes back to its senses. Could be the BlackBerry plugin (which is basically the whole reason I am using Eclipse to begin with). – AngryHacker Sep 29 '09 at 06:18
  • Hmm... in that case it may be worth looking at removing other plugins such as Mylyn... – Jon Skeet Sep 29 '09 at 07:12
  • 1
    @Jurily: It's a simple matter of efficiency. If you *can* put more memory in, it's usually a much better use of resources than trimming a few meg here and a few meg there. – Jon Skeet Sep 29 '09 at 08:34
  • 2
    Completely disagree. Developer machines should be *lower* spec than the intended end-user's machine by at least 50% (CPU and RAM) for exactly this reason. – finnw Jul 01 '10 at 00:30
  • 5
    @finnw: What makes you think that the workload of a developer machine is anything like the workload of the user's machine? Many applications don't need anything like as much in the way of resources as an IDE. You should certainly *test* your application on a low-spec machine, but that doesn't mean *developing* it on one. In fact, you're already apparently assuming a client-side app. If I'm developing a web app which is targeting mobile devices, should I develop on a mobile phone too? – Jon Skeet Jul 01 '10 at 05:30
  • 1
    Jon, do you use Eclipse much? Unfortunately, it's not so simple as just adding more RAM. Eclipse doesn't just use additional physical memory. You need to tinker with its settings to do that, and it's not trivial to get that working right. So, as opposed to most other applications, where I'd offer the same advice, "just throw RAM at it" isn't really a good answer here. – Nate Sep 26 '12 at 22:05
  • @Nate: Yes, I use Eclipse every day. It's really not that hard to get Eclipse to use more memory. – Jon Skeet Sep 26 '12 at 22:22
  • Yeah, actually it can be. Just using -Xmx (as shown in other answers), doesn't always let you set the value as high as your physical RAM might suggest (I can easily get told by Eclipse that it failed to create the JVM with -Xmx set ~1GB below this threshold). I've also had times where I mysteriously had to leave off the size in `-XX:MaxPermSize` or again, it fails to create the JVM. If it's me, and you have found the right params to get Eclipse to use all available RAM, please add those to your answer. Otherwise, it's incomplete (as well as not really what the OP asked). – Nate Sep 26 '12 at 22:33
  • @Nate: I think we'll have to agree to disagree. I've never seen those problems, although I'd always give the OS (and other tasks) a fair amount of headroom. I wouldn't *try* to get Eclipse to use all available RAM - I'd increase the total RAM until I could give Eclipse plenty, but still have plenty spare. As I said, RAM is pretty cheap, and of course it improves experiences beyond just Eclipse. – Jon Skeet Oct 10 '12 at 05:42
  • Right, but the question wasn't asking how to improve experiences beyond Eclipse, nor how to increase available memory. It was asking how to reduce memory usage for Eclipse, which is a valid problem to have, for several reasons, including the one the poster mentioned (stuck with the machine he's got). Glad to hear Eclipse has worked well for you. Many I've worked with have found it quite finicky. – Nate Oct 10 '12 at 05:48
  • 2
    @Nate: That was the direct question, but very often on Stack Overflow it's more useful to look at the *problem* than the *question*. If someone's concatenating values in SQL and forgetting some quotes, the direct answer to the *question* would be to add in the quotes, but the solution to the *problem* is parameterized SQL. If the OP is concerned about 400MB, then it seems to me that a general lack of memory for a developer machine is the wider problem. – Jon Skeet Oct 10 '12 at 05:53
  • Too often the developer laptop came with 8GB and the only option enabled by the IT dept is to add 8GB which would be enough if it weren't for also running VM.. – Skystrider Apr 26 '22 at 02:27
7

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.

Lucky
  • 16,787
  • 19
  • 117
  • 151
Mike
  • 2,393
  • 3
  • 25
  • 37
  • And how to change the garbage collector option for Eclipse? – Matthieu Jan 28 '16 at 12:02
  • 4
    Things have changed. The default GC in Java 8 now, is a generational garbage collector that also hands back memory to the system. You no longer want to mock with it... – Mike Jan 31 '16 at 04:49
  • 1
    In my case java 8 is happy to keep over 3GB when actual usage is less than 0.5GB, so unfortunately I do need to mock with it. – nsandersen Aug 22 '16 at 16:38
3

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.

György Andrasek
  • 8,187
  • 4
  • 48
  • 76
2

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.

Tim Spann
  • 517
  • 2
  • 6
  • I'm a bit confused, as you first have --launcher.XXMaxPermSize 512m and then --launcher.XXMaxPermSize 256m (and a couple of duplicate lines, i.e. defaultAction, and then nosplash together with showsplash ). Does it use the first configuration found ? – jambriz Oct 23 '14 at 21:34
  • it shouldn't have the 2nd one in there. i checked again and don't have that in my current one. Also if you are using JDK 8 different parameters – Tim Spann Oct 24 '14 at 17:39
1

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

googoo
  • 11
  • 1