PERM Java Area

Does garbage collection in the PERM Area Java heaps?

The PERM scope is used to store metadata about classes, methods, variables, etc. also a String Pool was created in the PERM heap area, so I believe that garbage collection does not occur here?

+4
source share
2 answers

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.

+3
source

I believe that theoretically, if the classloader is garbage collection, the classes loaded by this classloader can be garbage collected. These classes will be in the Permanent Generation.

0
source

Source: https://habr.com/ru/post/1344725/


All Articles