How can I reduce Eclipse Ganymede's memory use?
Asked Answered
B

13

34

I use the recent Ganymede release of Eclipse, specifically the distro for Java EE and web developers. I have installed a few additional plugins (e.g. Subclipse, Spring, FindBugs) and removed all the Mylyn plugins.

I don't do anything particularly heavy-duty within Eclipse such as starting an app server or connecting to databases, yet for some reason, after several hours use I see that Eclipse is using close to 500MB of memory.

Does anybody know why Eclipse uses so much memory (leaky?), and more importantly, if there's anything I can do to improve this?

Bayer answered 18/9, 2008 at 16:44 Comment(0)
L
34

I don't know about Eclipse specifically, I use IntelliJ which also suffers from memory growth (whether you're actively using it or not!). Anyway, in IntelliJ, I couldn't eliminate the problem, but I did slow down the memory growth by playing with the runtime VM options. You could try resetting these in Eclipse and see if they make a difference.

You can edit the VM options in the eclipse.ini file in your eclipse folder.

I found that (in IntelliJ) the garbage collector settings had the most effect on how fast the memory grows.

My settings are:

-Xms128m
-Xmx512m
-XX:MaxPermSize=120m
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing

(See http://piotrga.wordpress.com/2006/12/12/intellij-and-garbage-collection/ for an explanation of the individual settings). As you can see, I'm more concerned with avoiding long pauses during editting than actuial memory usage but you could use this as a start.

Littlefield answered 19/9, 2008 at 13:55 Comment(6)
You are my hero! I had switched back to Europa because of this and using these settings made Ganymede fly!Lack
This made a much bigger difference than I expected (even in newer Eclipse version).Pashm
Having gone through the newer Sun & Oracle documentation, I'd recommend changing -XX:+UseConcMarkSweepGC line with the newer G1 garbage collector: -XX:+UnlockExperimentalVMOptions (you may not need this line in JDK 7, not sure), then -XX:+UseG1GCLittlefield
I recommend leaving -Xms equal to -Xmx. This way the GC won't have to allocate more memory every now and then.Basseterre
If you want to use the new G1C1 garbage collection, you need to remove the -XX:+CMSIncrementalMode and -XX:+CMSIncrementalPacing options, so you end up with -Xms128m -Xmx512m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MaxPermSize=120m -XX:MaxGCPauseMillis=10 -XX:MaxHeapFreeRatio=70Blasting
I also had issues using the Eclipse GIT plugin with the G1C1 option enabled (Eclipse would just crash).Blasting
B
3

The Ganymede Java EE plugins are absolutely huge when running in memory. Also, I've had bad experiences with FindBugs and its reliability over a long coding session.

If you can't live without these plugins though, then your only recourse is to start closing projects. If you limit the number of open projects in your workspace, the compiler (and FindBugs) will have less to worry about and your memory usage will drop tremendously.

I usually split up my workspaces by customer and then only keep the bare-minimum projects open within each workspace. Note that if you have a particularly large projects (especially ones with a lot of files checked by WST), that will not only chew through your memory, but also cause a noticeable pause in responsiveness when compiling.

Brynnbrynna answered 18/9, 2008 at 16:58 Comment(1)
Or buy more memory. Why live without functionality to save a couple hundred MB of RAM?Linter
S
3

I don't think the JVM does a lot of garbage collection unless it has to (i.e. it's getting to its limits). Therefore it grabs all the memory it can get, probably up to the limit set in the eclipse.ini (the -Xmx argument, set to 512MiB here).

You can get a visual representation of the current heap status by checking 'Preferences' -> 'General' -> 'Show heap status'. It will create a small gauge in the status bar which also has a 'trash can' button you can use to trigger a manual garbage collection.

Shults answered 18/9, 2008 at 17:41 Comment(0)
S
3

Just for information,

  • you can add

    -Dcom.sun.management.jmxremote

to your eclise.ini file, launch eclipse and then monitor its memory usage through 'jconsole.exe' found in your jdk installation.

C:\[jdk1.6.0_0x path]\bin\jconsole.exe

Choose 'Connection / New connection / 'eclipse' to monitor the memory used by eclipse

  • always use the latest jvm to launch your eclipse (that does not prevent you to use any other jfk to compile your project within eclipse)
Sememe answered 19/9, 2008 at 11:28 Comment(1)
jvisualvm.exe found in the same place can attach to an unmodified, running Java program.Expugnable
L
2

Eclipse by itself is pretty bloated, and the more plugins you add only exacerbates the situation. It's still my favorite IDE, as it certainly isn't short on functionality, but if you're looking for a lightweight IDE then I'd suggest ditching Eclipse; it's pretty normal to run up half a gig of memory if you leave it running for awhile.

Liqueur answered 18/9, 2008 at 16:49 Comment(1)
Yeah, but you can't just show at work with RAM in your hand and cram it into the computer.Tiling
G
2

Eclipse is a pretty bloated IDE. You can minimize it by turning of the automatic project building under Project -> Build Automatically. It also can be helped by closing any open project you are not currently working on.

Greenleaf answered 18/9, 2008 at 16:59 Comment(0)
L
2

I'd call it bloated, but not leaky. (If it was leaky it would climb and climb until something crashed.) As others have said, memory is cheap! It seems like a simple decision to me: spend a tiny bit on more memory vs. lose productivity because you don't have the memory budget to run Eclipse @ 500MB.

Summarized rhetorical question: What is more valuable:

  1. The productivity gained from using an IDE you know with the plug-ins you want, or
  2. Spending $50-200 on some memory?
Linter answered 18/9, 2008 at 17:13 Comment(0)
S
1

RAM is relatively cheap (not that this is an excuse for poor memory managmentment). Unused memory is essentially WASTED memory. If you're hitting limits and the IDE is the problem consider less multitasking, adjusting your memory reqs, or buy more. I wouldn't cripple Eclipse if that's your bread-and-butter IDE.

Sunshade answered 18/9, 2008 at 16:55 Comment(0)
K
1

Instead of whining about how much memory Eclipse takes, just go ahead and analyze where the problem is. I might be just one plugin.

Check the blog here : "analyzing memory consumption of eclipse"

Regards, Markus

Kotick answered 20/10, 2008 at 15:45 Comment(0)
A
1

I had problem with java-based programs memory consumption. I found that it could be related to the chosen jvm (in my case it was). Try to run eclipse with -client switch.

In some operating systems (most of linux distros I believe), the default option is server vm, which will consume noticeable more memory when running applications with gui.

In my case initial memory footprint went down from 300MB to 80MB.

Sorry for my crappy English. I hope I helped.

All Regards Arkadiusz Jamrocha

Arsenious answered 21/7, 2011 at 11:51 Comment(0)
H
0

Well, you don't specify on which platform this occurs. The memory management may vary if you're using Windows XP, Vista, Linux, OS X, ...

Usually, on my computer (WinXP with 1Gb of Ram), Eclipse take rarely more than 200Mb, depengin of the size of the opened projects, the loaded plugins and the ongoing action.

House answered 18/9, 2008 at 16:52 Comment(0)
S
0

I usually give Eclipse 512 MB of RAM (using the -Xmx option of the JVM) and I don't have any memory problems with Ganymede. I upgraded to two GB of RAM a few months ago, and I can really recommend it. It makes a huge difference.

Sharrisharron answered 18/9, 2008 at 20:3 Comment(0)
W
-1

Eclipse generally keeps a lot of meta-data in memory to allow for all kinds of IDE gymnastics.

I have found that the default configuration of Eclipse works well for most purposes and that includes a limit (either given explicitly or implictly by the JVM) to how much memory can be consumed, and Eclipse will stay within that.

Is there any particular reason you are concerned about memory usage?

Whim answered 29/3, 2010 at 13:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.