Hi, I’m one of the ZGC devs. Have been playing around a bit with an interesting algorithmic extension of generational ZGC using a form of reference counting in the old generation. This allows us to essentially have young generation collections reclaim zero reference count old objects, and free up acyclic garbage in the old generation as well, just before it promotes objects from the young generation to the old generation. The consequence is that as long as long-lived garbage is acyclic, we pretty much don’t need to do major collections other than to defragment memory every now and then. But the actual pressure to reclaim old garbage vanishes and is handled from the young collections.
One quirk is that in this scheme, we can reclaim objects that never have an in-degree higher than 6, because then accounting isn’t free any longer (we are using available object header bits). I was delighted to find that cassandra memtables using skip lists are acyclic. But unfortunately I think the base nodes of the skip lists get too high in-degree and ultimately end up spoiling eager reclamation. So I’m wondering, how annoying would it be to change this map implementation to something that is both acyclic and has ref counts lower than 7 for any internal nodes? If that’s not too tricky to do, I suspect we could collapse the GC overheads related to having memtables in-heap. Maybe a tree structure or something? What do you guys think? If it’s too annoying that’s good feedback too. Please let me know if this is the wrong place for this kind of discussion. Thanks, /Erik
