JVM Garbage Collection (GC)
Java Heap Memory
The Young Generation is where all new objects are allocated and aged.
Tenure Generation stores old objects, which initially in young generation space, aged and moved to.
Permanent Generation Space stores metadata required by JVM to describe classes and methods used in the application.
JVM Garbage Collection
Minor garbage collection (quick, stop-the-world)Every time an object moved from one survivor space to another survivor space, they age. When their age reach 8 (JVM 8), they are moved to Tenure Generation Space.
GC strategy for minor garbage collection is Copying Collector.
When Tenured Generation filled up and to be cleaned up, major GC happens.
Major GC includes GC at Young Generation, following by GC at Tenured Generation.
GC strategy for Tenured Generation is Mark and Swipe, or Mark and Compact.
Full garbage collection (long, stop-the-world)
When Permanent Generation filled up and to be cleaned up, full GC happens.
Permanent GC includes GC at Permanent Generation, as well as GC at Young Generation and GC at Tenured Generation.
GC strategy for Tenured Generation is Mark and Swipe, or Mark and Compact.
Extra Questions and Answers
Q: After compaction at Copying Collection, the whole survival objects collection size are bigger than Survivor 0, what will happen?A: The current live objects which are not fit into Survivor 0/ Survivor 1, firstly they are moved to tenured section, which is dangerous because they didn't got moved because of age. Then the size of Survivor 0/ Survivor 1 adjusted using a ratio parameter.
Comments
Post a Comment