Understanding of Java's garbage collection mechanism

1. Cenozoic: All objects are created in the Eden area of ​​the Cenozoic. When the Eden area is full, the Cenozoic Minor GC is triggered to copy the surviving objects in the Eden area and the non-idle Survivor area to another free Survivor area.

2. Ensure that a Survivor area is empty. The new generation Minor GC is to copy surviving objects between the two Survivor areas until the Survivor area is full.

3. Old age: When the Survivor area is full, copy objects to the old age through Minor GC. After the old age is full, Full GC will be triggered to perform garbage collection for the entire heap (including the young, old, and persistent generations).

4. Persistent generation: If the persistent generation is full, Full GC will be triggered.

Insert picture description here

Guess you like

Origin blog.csdn.net/liulang68/article/details/114382056