Eclipse running out of memory?

Monday, August 25, 2008

At home, where I do most of my experimental development, I have a fairly substantial machine. It's windows, but don't hold it against me. It performs like a mofo. 64-bit, 4GB memory, Core2. At work, I have 32-bit, 2GB memory, Core2. I run Eclipse 3.3 with tons of plugins. I generally run eclipse from the command line with 512M heap, using the jdk1.6 JVM So imagine my surprise when I start getting OutOfMemory errors from eclipse at home. I traced it to the JBoss plugin, but couldn't figure out for the life of me why it was causing this behavior. I wasn't actively using any of the functionality in the plugin at the time I'd get the errors. I turned off auto-activation at startup for the jboss and a handful of other plugins, but to no avail. And this was getting in the way of me getting stuff done. Eclipse "manage configuration" is a flaky piece of shit, so disabling suspect plugins didn't work. Thus, I did what any red-blooded American would do: wipe out any folders in the plugins/features directories that referenced jboss. It was time for a fresh start. That fixed the memory problems and let me get back to work. But honestly.... could you live with that answer? I couldn't. So off I went. I asked the interwebs, and after nice traipse through various newsgroups and wikis and bugtrackers, I stumbled on a fix. Ooooooh, what a maddening f*cking fix. Here's the bottom line: my memory troubles went away when I added this to my startup file: -XX:MaxPermSize=256m That's all. By the way, here's where I ended up: If you're interested, that bug explains pretty well why I was hitting the memory issues I had. It doesn't explain why it was JBoss plugin causing it... but right now, I don't care. I also installed the memory monitor plugin attached to that bug. It's no better than what you get from jconsole, but marginally more convenient than attaching eclipse to a jmx session and typing "jconsole". So, if you're getting OutOfMemory errors while running eclipse, and increasing the heap isn't cutting it (-vmargs -Xmx512M), it's possibly not a heap problem but a permgen problem. --marc


seancorfield said...

PermGen space is using for loading class definitions so if you are constantly reloading classes (which you would be with JBoss embedded and being restarted over and over again) then you will run out of PermGen space fairly quickly.

I hit this a week or two ago and just increased the PermSize in Eclipse (as you found out) but I didn't think to blog it :(

Marc Esher said...

See, that's what was so bizarre to me: at the time, I wasn't doing anything at all with JBoss, i.e. I wasn't actively deploying projects nor did I even have the servers view up and doing things. And the other weird thing was that, at work, using a nearly identical eclipse setup, I have no memory problems at all.

Could be attributable to running 32 bit eclipse on 64bit vista... dunno.