Anthony Dahanne's blog

« | »

Jboss and java.lang.OutOfMemoryError: PermGen space

Once again, this infamous exception blew at my face when starting JBoss 4.2.3.GA today !
In fact, JBoss had to deploy 2 wars, one of them being a Web Service deploying war.
This exception occurred for one simple reason : the permgenspace is where class properties, such as methods, fields, annotations, and also static variables, etc. are stored in the Java VM, but this space has the particularity to not being cleaned by the garbage collector.
So if your webapp uses or creates a lot of classes (I’m thinking dynamic generations of classes), chances are you met this problem.
Here are some solutions that helped me get rid of this exception :

These options must be included in the JAVA_OPTS part of your Jboss run.bat or startup file.

Thank you Stephane for giving me the solution !

Posted by on Mercredi 12 août 2009.

Categories: java

9 Responses

  1. Thanks for tell the solution. I from Brazil.

    by Flávio Nóbrega on août 22, 2009 at 13:25

  2. You’re welcome !

    by Anthony Dahanne on août 22, 2009 at 14:35

  3. Thanks a bunch. That helped.

    by Ravi on oct 8, 2009 at 20:12

  4. Thank you very much :-). It helped a lot.

    by Sunkara on déc 7, 2009 at 15:42

  5. Hi, Thanks for posting.I tried the Garbage collecter uses as —> System.gc(); I m actually parsing the location of images from sdcard(pictures.xml file). But unable to get the correct values all times… What i do?

    by jetti on déc 27, 2009 at 09:57

  6. Got the same issue with 5.0.1.GA. In this case, -XX:+CMSClassUnloadingEnabled is enough!

    Thank you from Italy

    by pasquale on avr 14, 2011 at 12:29

  7. Hi,i’ve got same error and i’m trying many times to change JAVA_OPTS into run.conf but it’s still same size after check it by jmap…pls, do you have any suggestions..?
    i’ve jboss 4.2.2GA, java hotspt server 64 bit, red hat centos, 8GB

    by Hazem on mai 21, 2011 at 17:07

  8. Hi Hazem,
    It is not so simple to answer – what kind of options do you pass
    ss ? have you run GC logs to verify if PermGen is collected ? I was just working on PermGen OOM issue and root cause analysis is very time consuming in applications larger than “HelloWorld”


    by Maciej on juin 17, 2011 at 13:16

  9. i have tried but it has not worked yet …

    by derek on déc 9, 2011 at 13:52

Leave a Reply

− 2 = 7

« | »

Articles récents


About Anthony Dahanne's blog

Since I got my engineer degree (2005), I have been working on several missions (as a software developer, or a trainer) involving Java technologies from JEE to OSGi, including Android, GWT and even sometimes with Ruby / Ruby on Rails. Those missions touched business areas as different as banking (SGCIB, Crédit Agricole S.A.), travel (Club […]more →