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 (eg 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?


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.


I don't think the JVM does a lot of garbage collection unless it has to (ie 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.


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]binjconsole.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)
  • 链接地址: http://www.djcxy.com/p/90556.html

    上一篇: Eclipse 3.4(Ganymede)的内存使用率是否明显高于3.2?

    下一篇: 我如何减少Eclipse Ganymede的内存使用量?