Get the latest tech news
Writing a .NET Garbage Collector in C# – Part 1
First part of a series of articles about writing a .NET Garbage Collector in C# using NativeAOT. This part sets the expectations and setups the project, dealing with the first difficulties.
Like for the profiler in .NET, there are two reasons why using “vanilla” .NET is impossible: first, the GC is initialized very early in the process, at a point in time when the CLR isn’t ready to run managed code yet. If we publish it with NativeAOT then run it, it immediately crashes with the same access violation, even though we’re never setting the DOTNET_GCName environment variable or even trying to invoke the GC_Initialize function. Don't hesitate to check the 2nd edition of Pro .NET Memory Management for more insights on the .NET Garbage Collector internals!
Or read this on Hacker News