Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.OutOfMemoryError: PermGen space in Eclipse Helios

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.

like image 558
Joeblackdev Avatar asked Jun 30 '11 15:06

Joeblackdev


2 Answers

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

-XX:MaxPermSize=128m

That should help.

like image 118
Sebastian Zarnekow Avatar answered Sep 20 '22 19:09

Sebastian Zarnekow


I'm using Eclipse Helios build - 1415 (64 Bit). Adding it to the run configurations above didn't work for me. I had to go in and add it to the eclipse.ini file. Just appended it towards the end of the file and restarted eclipse and it works.

like image 39
vineets Avatar answered Sep 20 '22 19:09

vineets