Monday, December 24, 2012

PermGen Space eclipse


Fixing the Eclipse PermGen Space (Out of Memory) Error
When Using JDK 1.6.0_21


Eclipse has a very serious bug where it does not properly pass the memory limits from eclipse.ini to Java. As a result, Eclipse quickly runs out of memory and crashes with little warning and few obvious error messages. This bug applies only to jkd1.6.0_21 and later on Windows, but applies equally to Eclipse 3.6 (Helios), Eclipse 3.5 (Ganymade), and Eclipse 3.4 (Europa). 


One of the reason is due to changes in "Java 6u21 distribution"
The change was done in "java.dll" to replace "Sun MicroSystems" to "Oracle Corporation"


Solutions :


To fix this, go to the Eclipse installation folder (e.g., C:\eclipse) and add the following to the bottom of eclipse.ini:

  -XX:MaxPermSize=256m

Patched 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.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256m
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m

Note that 256M is the default memory setting for Eclipse. If you choose to increase it, change the -XX:MaxPermSize accordingly. For more details, please see