Over a million developers have joined DZone.
Silver Partner

OutOfMemoryError in Eclipse with JDK 1.6.0_21, on Windows

· Java Zone

The Java Zone is brought to you by Stormpath—offering a pre-built identity API for developers. Easily build powerful user management, authentication, and authorization into your web and mobile applications. Check out this tutorial to build a simple web app with Spring Boot and Spring Security in 15 minutes.

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 by Stormpath—offering a pre-built, streamlined user management API for building web and mobile applications. Learn how token authentication with JWTs (JSON Web Tokens) helps secure websites and avoids the pitfalls of using cookies and sessions.

Topics:

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

{{ parent.tldr }}

{{ parent.urlSource.name }}