With each deployment, new class objects are placed in PermGen and thus take up an increasing amount of space. No matter how big you occupy the PermGen space, it will inevitably end after enough deployment. What you need to do is take steps to clean PermGen so that you can stabilize its size. There are two JVM flags that handle this cleanup:
-XX:+CMSPermGenSweepingEnabled
This option enables PermGen in the start of the garbage collection. By default, PermGen space is never included in garbage collection (and thus grows without restriction).
-XX:+CMSClassUnloadingEnabled
This parameter tells the PermGen swing garbage collection to take action on class objects. By default, class objects are freed even when PermGen space is visited during a garabet collection.
source share