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:
-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.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Michal Huniewicz replied on Tue, 2010/07/20 - 4:43am
Alex, what does it mean exactly: "Eclipse was not setting the flag -XX:MaxPermSize, due to the change of vendor, from Sun to Oracle"?
Thanks for the article, I was getting the problem too; hope this will fix it.
Francisco Ceruti replied on Tue, 2010/07/20 - 5:14am
Alex Ruiz replied on Tue, 2010/07/20 - 8:15am
in response to:
Michal Huniewicz
James White replied on Tue, 2010/07/20 - 8:53am
Naiden Gochev replied on Tue, 2010/07/20 - 9:15am
I am running eclipse 3.6 with Java 1.6_21 I also have a lot of problems on my Windows XP 32bit machine with 3.5gb ram.
I am having all types of problems with all versions of eclipse mostly because the default config is total crap.
anyway my current ini file looks like that and eclipse run very very very well.
-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
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms70m
-Xmx512m
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:MaxGCPauseMillis =100
-XX:GCPauseIntervalMillis =1000
-XX:+G1YoungGenSize=256m
-XX:+G1ParallelRSetUpdatingEnabled -XX:+G1ParallelRSetScanningEnabled
-XX:MaxPermSize=384m
-XX:PermSize=128m
I hope it helps to someone.
Paul Gregoire replied on Tue, 2010/07/20 - 10:44am
bruce wang replied on Tue, 2010/07/20 - 11:17am
CPU: Intel(R) Core(TM)2 Duo CPU P8700
Memory: 3G
Win 7 + jdk-6u21-windows-i586 + eclipse-jee-helios-win32.
I have also experienced the same problem, eclipse frequent(minutes) crashes(OutOfMemoryError). Now my eclipse.ini file looks like that and eclipse run very well.
-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.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256M --launcher.defaultAction openFile -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms128M -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=256M -XX:+UseParallelGC -XX:ParallelGCThreads=2
Michal Huniewicz replied on Tue, 2010/07/20 - 2:45pm
in response to:
Alex Ruiz
Sandeep Khurana replied on Tue, 2010/07/20 - 11:04pm
Thomas Kern replied on Thu, 2012/09/06 - 11:01am
hi there,
I also got the same problem while using “myeclipse for spring 8.6 M2″. Since I’m a new user of myeclipse, I attributed that to myeclipse instead of JDK 1.6.0_21.
I changed my eclipse settings as well.
http://www.java-tips.org