PERM Area of Java
Does garbage collection occurs in PERM Area
of Java Heap ?
PERM area is used to store meta data about classes, methods, variable etc... also String Pool created in PERM area of heap so I belie开发者_运维百科ve garbage collection does not occur here?
With each deployment, new class objects get placed into the PermGen and thus occupy an ever increasing amount of space. Regardless of how large you make the PermGen space, it will inevitably top out after enough deployments. What you need to do is take measures to flush the PermGen so that you can stabilize its size. There are two JVM flags which handle this cleaning:
-XX:+CMSPermGenSweepingEnabled
This setting includes the PermGen in a garbage collection run. By default, the PermGen space is never included in garbage collection (and thus grows without bounds).
-XX:+CMSClassUnloadingEnabled
This setting tells the PermGen garbage collection sweep to take action on class objects. By default, class objects get an exemption, even when the PermGen space is being visited during a garabage collection.
I believe that theoretically if a class loader is garbage collected the classes that were loaded by that classloader can be garbage collected. These classes would be in the Permanent generation.
精彩评论