java.lang.OutOfMemoryError: PermGen space in Eclipse Helios

Joeblackdev picture Joeblackdev · Jun 30, 2011 · Viewed 21.8k times · Source

I have created an Xtext plugin in eclipse. Every time I launch it as an 'Eclipse Application' via the context menu, I get a few moments grace before the new Eclipse instance crashes. I switch back to the original instance and in the console window I see

Root exception:
java.lang.OutOfMemoryError: PermGen space

I have looked back at some solutions in the forums but a lot relate to tomcat. Can someone give me a few suggestions as to how I could fix this? I am using Eclipse helios. My 'eclipse.ini' file looks like:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx384m

The machine I am running eclipse on has just about 4GB of RAM

======================================================================

Update: I hope this is helpful to anyone who may have the same problem. I followed the instructions here and tried setting the -XX:MaxPermSize=256m in my eclipse.ini file. This did not work. Eventually, I had to uninstall java sdk (I was using the latest jdk1.6.0_26) and I installed an older version (jdk1.6.0_20) from here. I then set -XX:MaxPermSize=256m in my eclipse.ini and it now looks like the following:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Xms40m
-Xmx1024m
-XX:MaxPermSize=256m

I hope this helps out someone in the same situation. This problem was happening when I'd launch my Xtext plugin.

Answer

Sebastian Zarnekow picture Sebastian Zarnekow · Jul 2, 2011

Please add following to the vm parameters in the launch configuration (Run -> Run Configurations)

-XX:MaxPermSize=128m

That should help.