Over a million developers have joined DZone.

OutOfMemoryError in Eclipse with JDK 1.6.0_21, on Windows

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

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:

-startup
plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vm
D:\Java\jdk1.6.0_21\bin\javaw.exe
-vmargs
-Xms512m
-Xmx1024m
-XX:MaxPermSize=256m

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.

 

From http://alexruiz.developerblogs.com/?p=1377

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}