Bye, Bye PermGen, Hello Metaspace
PermGen has been completely removed.
Metaspace garbage collection - Garbage collection of the dead classes and classloaders is triggered once the class metadata usage reaches the MaxMetaspaceSize
.
The space Metadata
was held is no longer contiguous to the Java heap
, The metadata
has now moved to native memory to an area known as the Metaspace
.
In Simple words,
Since the class metadata is allocated out of native memory, the max available space is the total available system memory. Thus, you will no longer encounter OOM errors
and could end up spilling into the swap space.
The removal of PermGen
doesn’t mean that your class loader leak issues are gone. So, yes, you will still have to monitor your consumption and plan accordingly, since a leak would end up consuming your entire native memory.
Some other articles, with analysis: Link1, Link2 , and this