java.lang.OutOfMemoryError: PermGen space in tomcat with eclipse

Solution 1:

try to raise perm space, add following parameters to vm start-up

-XX:PermSize=256m -XX:MaxPermSize=256m

also add -XX:MaxPermSize=256m to Tomcat in Eclipse: Server > Open Launch Configuration > Arguments

Update (in 2014): take a look here at this question and answer about the new Java 8 Metaspace.

and take a look here:

How to deal with “java.lang.OutOfMemoryError: PermGen space” error

Solution 2:

You can configure these arguments for eclipse:

"To solve this I stopped the server in Eclipse. Double clicked on the server in the Servers tab to open the Overview page for the server. Clicked on Open Launch Configuration and then on the Arguments tab.

I added the following VM arguments :

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

ref to http://malcolmmallia.com/malcblog/?p=60

Solution 3:

I got this problem today as well. It happened completely out of the blue. Yesterday I've updated JDK/JRE from 1.6.0_13 to 1.6.0_21 to fix a Glassfish 3.0.1 specific issue and Eclipse suddenly broke with those OutOfMemoryError: PermGen space errors. After (incorrectly) ranting on the Glassfish plugin and concluding that the issue wasn't fixed after cleaning the workspace metadata, it turns out that this is caused by the change of JVM vendor string from "Sun" to "Oracle" since 1.6.0_20. Eclipse didn't recognize the new JVM vendor and thus didn't apply the VM arguments as specified in eclipse.ini.

This was reported as Eclipse issue 319514 and the Eclipse boys quickly released a patch. Until they get it fixed more permanently, the workaround is indeed to add the following lines to the eclipse.ini:

-XX:MaxPermSize=256m

So, if you recently did a JVM update, it might be worth to take a look to it.