What is the significance of PermGen space in java?
PermGen space is reserved for long-term objects - mostly Class
objects loaded by the ClassLoader
. PermGen will not be garbage collected except under very special circumstances (specifically, when the ClassLoader
that loaded those classes goes out of scope).
This is a garbage collection optimization - if objects that we don't expect to be garbage collected are stored separately, it compacts the space where the rest of the objects are stored, which leads to less work for the garbage collector.