1) System.gc() works more often than not. What people mean when they say that you cannot force garbage collection is that the JVM knows more about the state of memory than you, you cannot force garbage collection if the JVM knows that this is not the right time for this .
2) I do not believe that user-created classes will turn it into perm gen (although I may be wrong), it exists to store meta-information, such as classes and interned strings (pre Java 7), etc., which are always required by the JVM.
3) A static variable is a reference using the class that they are declared. Classes are stored in the constant generation, therefore, by their nature, a static variable will always be referenced, therefore it makes sense to also have them in perm gen.
4) Yes.
Edit comment: Garbage collection is never done on a permanent generation. I'm right?
Not really. Garbage collection is complicated! The permanent gene is much less volatile than the rest of the heap, and it is very likely that objects there will refer to others in the lower spaces. I think that the behavior of the garbage collection and perm gen depends on the version of Java you are using, I believe that new versions will also garbage collect perm gen, which makes sense, since Java uses proxy objects a lot.
source share