OutOfMemoryError in Eclipse with JDK 1.6.0_21, on Windows
This past weekend I spent a good amount of time trying to solve an OutOfMemoryError that made Eclipse crash every 5 minutes. I’m running Eclipse Helios on JDK 1.6.0_21, with the following plug-ins: Subclipse, m2eclipse and Atlassian Eclipse Connector. It was hard to figure out which one was the troublemaker, since I installed everything in one shot on my new Windows laptop.
After a couple of hours of frustration, I finally found the solution in this post from Konstantin’s blog: Eclipse was not setting the flag -XX:MaxPermSize, due to the change of vendor, from Sun to Oracle, in JDK 1.6.0_21. This is a Windows-only issue. As Konstantin points out, the fix is simple: just add the missing flag (with the appropriate amount of memory) to the eclipse.ini file, just after the -vmvargs settings.
Here is my eclipse.ini:
Setting -XX:MaxPermSize to 512m (as Konstantin suggests) didn’t work for me. On my machine, Eclipse can only run if I set that flag to 256m.
For more details, including the bug number related to this issue, please visit Konstantin’s blog.