DigiNews

Tech Watch Articles

← Back to articles

Writing a .NET Garbage Collector in C# – Part 6: Mark and Sweep

Quality: 7/10 Relevance: 6/10

Summary

Part 6 continues the author's project to implement a .NET garbage collector in C#. It details the mark phase starting from roots (locals, thread-static storage, GC handles, finalization queue) and introduces ScanContext, the GcScanRoots callback, and conservative mode notes. It then outlines a DFS-based marking pass and a sweeping phase that clears unreachable objects, reuses memory with free objects to keep the heap walkable, and references prior parts for heap layout and reference discovery.

🚀 Service construit par Johan Denoyer