December 24, 2012

Fixing performance and memory issues in Eclipse or Force.com IDE

Eclipse needs a decent amount of heap(Memory | RAM) to work smoothly, minimal heap sizes start from 256 MB RAM and upper limit to that value usually depends on the eclipse plugins and amount of physical RAM installed on your machine.
Chances of eclipse being slow on low heap configuration are high, this is because you are overloading your processor and disk in classic RAM <> Disk swap cycles and CPU processing going on during the same. If this heap falls below a certain level, you might see Eclipse crash with errors like “OutOfMemoryError: Java heap space”.
This post tries to cover a couple of Eclipse flavours/variants and ways to fix performance and memory issues on the same. As Force.com IDE itself is based on Eclipse, so most of the tips apply to Force.com IDE users as well.


How to fix Performance ?

One simple way to boost performance is to use an extremely good configuration machine. But that also not guarantees a good performance if your IDE is not having good defaults. Here are few tips that might help

Too many plugins

Having an Eclipse running with too many un-used plugins doesn’t helps. I have seen developers downloading Eclipse variants with support of lots of languages and features, most of which we usually don’t need. A good example is Force.com IDE, some developers tend to download JEE version of eclipse and install Force.com IDE as a plugin on top of that, this combination is of no use until you are JEE developer your self.
Recommended way is to download the minimal version of eclipse and get the job down with the really required plugins.
  • Force.com developers: best bet is to use standalone version of Force.com IDE, which is really a low fat version of Eclipse with the basic required features. I personally use it for all Force.com related development and find it good and better in startup and normal usage speeds.  One can download standalone version from here : http://wiki.developerforce.com/page/Force.com_IDE_Installation
  • Java/JEE developers: Their are many options and rich suite of plugins available. You can make best judgement based on nature of your work, mostly JEE version of eclipse would suffice for normal JEE developer, and can be enhanced with good plugins like SVN(Subversive) and Mavens(M2E). But if you are using spring core and plan to opt Spring Tool Suite for the same, you might be making mistake by opting something too heavy that is no where required at all. This doesn’t means STS is a bad tool, make sure you need that STS goodness if you are planning to go for it Smile 
One way that worked best for me is to have a second experimental eclipse installation, that is for experimental use only. For ex. you read about Android development and excitement to develop something makes you install the android plugin for eclipse. If this exercise is done in experimental eclipse installation it would help a lot, as you will be done with your research and in case something goes wrong during plugin installation, your main working eclipse copy is not disturbed at all.
Once you feel that a plugin in experimental installation is of real good use and stable, you can move it to the core Eclipse installation. I know we have un-install plugin feature, but that has messed me a few times by leaving traces of crap.

Too many open projects and files


We end up checking out or creating multiple projects for various clients or own research. Eclipse housekeeping and RAM usage boosts with the number of open projects and files in workspace, a decent boost can be noticed by closing unused projects in workspace. I usually keep multiple eclipse workspaces for various stuff like
  • Client projects
  • Personal Apps
  • Research Projects or Open Source work

Increasing heap size


If you are having a good amount of RAM installed/freely available on your machine, you can ignore the tips above and just boost the Eclipse heap setting to make the most out of the available RAM.
Following table lists various eclipse variants and video tutorials for each to tune the heap size.
Eclipse Variant OS Video: How to fix the heap ?
Eclipse standard Mac
STS (Spring Tool Suite) Mac
Force.com Standalone IDE Mac
Force.com Standalone IDE Windows
Eclipse Other Try following the steps in above videos, configuration should be similar

 


Your feedback


Looking forward for the same.