All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Implementing the Mark Phase in a .NET Garbage Collector Built with C# and NativeAOT

By

vyrotek

4mo ago· 7 min readen

Summary

This article is part 6 of a series on building a .NET garbage collector in C# using NativeAOT. It focuses on implementing the mark phase of garbage collection, explaining how to traverse object graphs to identify live objects by marking reachable objects from roots. The article builds on previous parts that covered GC APIs, memory layout, and reference finding, providing technical implementation details for a mark-and-sweep garbage collector in .NET.

Key quotes

· 5 pulled
After a long (way too long) break, it's time to resume our journey towards building a .NET garbage collector in C#.
In the previous parts, we saw how to implement the minimal set of GC APIs to allow a simple application to run, and how to lay out the objects in memory to make the heap walkable.
We then learned how to find the references of a given managed object.
If you need a refresher, don't hesitate to...
In the sixth part, we start implementing the mark phase of the garbage collection.
Snippet from the RSS feed
Using NativeAOT to write a .NET GC in C#. In the sixth part, we start implementing the mark phase of the garbage collection.

You might also wanna read