Java Permg and Garbage Collection, Busting permgen myths

I know that in the JVM, the permgen scope is used to store class definitions. In my Tomcat, I see that the current memory usage of perment is about 100 MB, it seems that it only grows over time, even there no one uses applications in Tomcat My questions:

Is it true that permgen was never going to collect garbage, I mean that the memory used there continues to grow and grow?

When does perm receive garbage collection?

What does "CMSPermGenSweepingEnabled" and "CMSClassUnloadingEnabled" mean?

My maximum permgem size is 256, and I don't want to have an OutMemoryException next week.

Please only accurate and documented answers.

I use Tomcat 7, Java 7, I use a lot of tecnique parallel deployment and I do undeploys, redistributing several times a week. I never use the intern () method for strings

+3
source share
1 answer

In fact, it’s not true that Permgen never collects garbage. It contains classes that are loaded by the application and collected when class loaders receive garbage collection , usually in redistribution scenarios.

You can use these JVM flags to see when classes are loaded and unloaded from permgen:

-XX:+TraceClassLoading -XX:+TraceClassUnloading

To find out which classes are loading, use this flag:

-verbose:class

, , , visualvm, lie sun.reflect.GeneratedMethodAccessor11.

answer, Permgen, , /.

+2

All Articles