Wednesday, November 22, 2006

Eclipse Tuning

Everybody loves Eclipse, right? It's become ubiquitous, right? It's been my primary IDE for a couple of years now. Lately, I've run across some issues with it though. And when I say issues, I mean crashes.

Eclipse has a relatively easy to find log file (in $project_home/.metadata/.log) and I quickly found the problem:

!MESSAGE Failed to execute runnable (java.lang.OutOfMemoryError: PermGen space)

The dreaded Java out of memory problem. I found a couple of interesting bits on this particular variant of the out of memory problem, i.e. PermGen space. This article points to using the JVM flags for increasing PermGen size, while this one claims that HotSpot has garbage collection problems on long running processes (I have Eclipse open all day usually) but that JRockit does not have these problems.

I have some experience with tuning my JVM, so I decided to tune Eclipse as my first option. To do this, you just have to edit $eclipse_home/eclipse.ini. Here is what mine looks like now:

-vmargs
-Xms256m
-Xmx512m
-Xmn128m
-XX:+UseParallelGC
-XX:MaxPermSize=128m

This seems to work pretty good. I haven't had any crashes since then and Eclipse launches much more quickly. I threw the UseParallelGC in there to take advantage of the extra core on my CPU, but I'm thinking of removing that. Seems like Eclipse is a little less responsive with that option, but that's very subjective.

No comments: