This blog post summarises a new garbage collection algorithm called Mark-Scavenge, which highlights how using reachability as a proxy for liveness in

Mark–Scavenge: Waiting for Trash to Take Itself Out – Inside.java

submited by
Style Pass
2024-11-24 03:30:05

This blog post summarises a new garbage collection algorithm called Mark-Scavenge, which highlights how using reachability as a proxy for liveness in moving GCs leads to unnecessary data movement and how we can address this. This work is from the latest paper within the research collaboration between Oracle and Uppsala University. The full paper can be found on the ACM website.

Modern garbage collection assumes that the weak generational hypothesis holds and that most objects die young [4]. To that end, the heap is partitioned by age into regions. If the weak generational hypothesis holds, most objects in a young region will become garbage at almost any given time. Thus, within the young generation, a garbage collection algorithm that operates on live objects will be more efficient than one that operates on garbage objects, as the number of live objects will be substantially fewer. Consider the example below where the GC needs to reclaim memory.

Since regions A and C have four live objects and region B has only two, selecting the sparsely populated region B for evacuation is the most efficient, as you only get memory back if you empty the whole region. In this example, we evacuate (move) objects e and f to region D, and after updating the incoming pointers, the entire region B is now free. So far so good, but what does it mean when a GC considers something to be live? According to The Garbage Collection Handbook [1]:

Leave a Comment