Dónal
Dónal

Reputation: 187529

How can I reduce Eclipse Ganymede's memory use?

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?

Upvotes: 34

Views: 38760

Answers (13)

Daniel Spiewak
Daniel Spiewak

Reputation: 55123

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.

Upvotes: 3

Arkadiusz Jamrocha
Arkadiusz Jamrocha

Reputation: 11

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

Upvotes: 1

Stu Thompson
Stu Thompson

Reputation: 38878

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?

Upvotes: 2

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?

Upvotes: -1

kohlerm
kohlerm

Reputation: 2624

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

Upvotes: 1

GKelly
GKelly

Reputation: 3919

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.

Upvotes: 34

VonC
VonC

Reputation: 1324258

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)

Upvotes: 3

Johannes K. Lehnert
Johannes K. Lehnert

Reputation: 949

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.

Upvotes: 0

Henrik Heimbuerger
Henrik Heimbuerger

Reputation: 10193

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.

Upvotes: 3

Clark
Clark

Reputation:

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.

Upvotes: 2

basszero
basszero

Reputation: 30014

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.

Upvotes: 1

gizmo
gizmo

Reputation: 11909

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.

Upvotes: 0

Magsol
Magsol

Reputation: 4690

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.

Upvotes: 2

Related Questions