PermGen problems with Lift and Jetty

后端 未结 5 1616
死守一世寂寞
死守一世寂寞 2020-12-23 02:33

I\'m developing on the standard Lift platform (maven and jetty). I\'m repeatedly (once every couple of days) getting this:

Exception in thread \"7048009@qtp-         


        
5条回答
  •  时光取名叫无心
    2020-12-23 02:59

    From this post:

    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 :

    • -XX:+CMSClassUnloadingEnabled : this setting enables garbage collection in the permgenspace
    • -XX:+CMSPermGenSweepingEnabled : allows the garbage collector to remove even classes from the memory
    • -XX:PermSize=64M -XX:MaxPermSize=128M : raises the amount of memory allocated to the permgenspace

    May be this could help.

    Edit July 2012 (almost 3 years later):

    Ondra Žižka comments (and I have updated the answer above):

    JVM 1.6.0_27 says: Please use:

    • CMSClassUnloadingEnabled (Whether class unloading enabled when using CMS GC)
    • in place of CMSPermGenSweepingEnabled in the future

    See the full Hotspot JVM Options - The complete reference for mroe.

提交回复
热议问题