I feel like I am missing something painfully simple but I am trying to understand mark and sweep garbage collection per Andrew Appel's Modern Compiler Implementation in ML book and there's a small paragraph inside the Mark and Sweep section titled Pointer Reversal (270).
At this point I think I understand how it works. In a nutshell, as you traverse the graph you flip all the pointers so that your predecessor is inside your set of fields. Then when you are done with a given element, you flip the pointers back so they point at the right place again.
If that is correct, what exactly does it buy you? Appel attempts to explain this but I don't fully grok his wording.
The mark-and-sweep algorithm is called a tracing garbage collector because it traces out the entire collection of objects that are directly or indirectly accessible by the program. Example: A. All the objects have their marked bits set to false.
The Concurrent Mark Sweep (CMS) collector is designed for applications that prefer shorter garbage collection pauses and that can afford to share processor resources with the garbage collector while the application is running.
The Generational Garbage Collection ProcessBoth survivor spaces start out empty. When the eden space fills up, a minor garbage collection is triggered. Referenced objects are moved to the first survivor space. Unreferenced objects are deleted when the eden space is cleared.
Generational Garbage Collection. One of the limitations of simple garbage collection algorithms is that the system has to analyze all the data in heap. For example, a Copying Algorithm has to copy all the live data every time it used. This may cause significant increases in execution time.
During marking, objects fall into three categories:
As marking proceeds, objects change state from category 1 to category 2, and from category 2 to category 3. The garbage collector has to keep track of all objects in category 2 so that it can find all unmarked objects. But where does it store that information? Garbage collection may be running when memory is completely full, so it cannot dynamically allocate a data structure. It should build a data structure holding objects in category 2, using the memory that is already allocated. Pointer reversal is an algorithm for building a linked list of these objects without allocating memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With