views:

7157

answers:

13
+6  Q: 

Eclipse memory use

Hi,

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.

Cheers, Don

A: 

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.

Magsol
Ditch it for what? Memory is cheap...
Stu Thompson
A: 

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.

gizmo
+1  A: 

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.

basszero
+2  A: 

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.

Daniel Spiewak
Or buy more memory. Why live without functionality to save a couple hundred MB of RAM?
Stu Thompson
A: 

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.

+1  A: 

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. loosing 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?
Stu Thompson
+1  A: 

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.

hheimbuerger
A: 

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.

jkl
+2  A: 

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)
VonC
jvisualvm.exe found in the same place can attach to an unmodified, running Java program.
Thorbjørn Ravn Andersen
+8  A: 

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.

GKelly
You are my hero!I had switched back to Europa because of this and using these settings made Ganymede fly!
Yorgos Pagles
+1  A: 

Hi all, 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

kohlerm
A: 

Can someone please give me the details about the Eclipse memory usage in Windows XP and Linux? I heard Eclipse consumes less memory in Linux compared to Windows? Is it true? What ever the OS is, IDE will look for some amount memory so how will it vary with OS?

Nareshreddy Kola
A: 

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?

Thorbjørn Ravn Andersen