java garbage collection about ZGC and G1

coffee :

What is the difference between ZGC's relocation set and G1' s collection set in Java?I and learning JAVA's garbage collection and feel uncertain about this.

Eugene :

Collection Set are the regions that G1 considers to look further at. G1, in the mark phase, will compute some metadata about each region, one of those metadata information is how much is alive in each of them. It also knows how much time it took on the previous run to reclaim dead objects in each region. To meet it's goals of timeouts, it selects the regions with the most garbage and processes them. Those regions are called: collection set.

Relocation Set is basically the same thing, at least logically. ZGC selects regions (they call them pages) with most garbage. It first, under a stop-the-world event, relocates GC roots, and then, concurrently traverses this Relocation Set.

So in essence these are close to the same thing logically, since these GC are doing things quite differently, that is the bound where their similarities should be drawn, IMO.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=17869&siteId=1