Introduction to ZGC Garbage Collector

The algorithm is called: Colored Pointer

GC information is recorded on the pointer, not on the header (for example, the serial collector records on the markword).
This only deals with the pointer regardless of the object referenced by the pointer, so that you don't have to worry about object changes and references.
Record pointer benefits: immediate memory use, memory can be reused immediately. Zgc, like G1, regions will be cleaned up, compressed and transferred in time, which can make memory reuse more timely.

ZGC currently supports Linux 64-bit, and 42-bit pointers are used to represent the address of the object. The addressing space is 4T, and one address stores 8bit, that is, 4TB address space.
Expanded to 16T in JDK13.
Color pointers: Finalizable, Remapped, Marked1, Marked0, This is the state of each object in the gc process

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_33873431/article/details/112130380