Make your custom .NET GC - "whys" and "hows"
summary
Starting with .NET Core 2.1 a feature called Local GC lets a native DLL replace the runtime GC by exporting version and initialize hooks and implementing the GC heap interface; a minimal 0 GC allocates with VirtualAlloc/VirtualAlloc-like calls, implements handles and allocation paths, and surprisingly matches throughput while consuming far more memory and CPU. Practical work requires building a debug runtime, using suspendEE/restartEE, handling many runtime asserts, and is blocked today by the missing API to traverse object references for a real mark-and-sweep GC.
AI-written summary · about
chapters (10)
- 0:00Start
- 0:26Agenda
- 5:35Ultimate Goal
- 8:46Memory Pressure Testing
- 15:06Exported Methods
- 18:54Garbage Collect
- 23:37Memory Usage
- 38:18Implementation of the Gc
- 41:28Summary
- 42:54What's Next
related talks
05mInterview
59mIntroduction to unsafe C#: Calling native code and crashing in entirely new ways
01h 03mTaming dynamic memory
37mTrack your memory allocation
57mDynamic memory allocation challenges in safety critical systems
58mHigh-performance code design patterns in C#
09mBringing Rust to .NET
50mTwo advanced PMR techniques in C++17/20
