OutOfMemoryError: PermGen space

I encountered this error with Tomcat 5.5 and in Eclipse as well when using Web Tools features. Adding the following JVM options resolved the problem:

-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

Of course, you can use a different value for the MaxPermSize depending upon the available RAM.

For Eclipse, I added these options to the shortcut:

C:\programs\eclipse\eclipse.exe -vmargs -Xmx768M -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

For Tomcat, I edited catalina.bat to add the following line:

set JAVA_OPTS=%JAVA_OPTS% -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

Advertisements

7 thoughts on “OutOfMemoryError: PermGen space

  1. Hi,

    I have the same problem running Liferay. Could you explain with more detail where do you exactly add the option and how do you write down? Thanks in advance

  2. You will need to modify the startup command for the application server. It may be in a batch file. For example, if you are using Tomcat it is in catalina.bat as explained in the post.

  3. Hi,

    Thanks for your reply.

    I am running Liferay on Apache-Tomcat. Do I need to to do the modification in JVM or only in catalina.bat And if I need to do in JVM, in which script?

  4. Hi –

    I’m having Out of Memory issue (using Intelli J), I have modified all the project settings to increase heap size, still getting that error.

    Any advise?

    Thanks,

  5. You don’t need to modify project settings. Try passing the arguments to IntelliJ at startup like shown for Eclipse in the post above. If you use a shortcut to start it, you can set the arguments in the shortcut.

  6. yes.. working fine

    I edited catalina.bat to add the following line:

    set JAVA_OPTS=%JAVA_OPTS% -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:MaxPermSize=256M

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s