Manual Memory Management in .NET Framework
summary
Shows how to copy and allocate reference objects anywhere by using TypedReference and __makeref/__refto, then getting raw pointers to object headers and fields to place an object on the stack or inside a custom allocator. Demonstrates patching the CLR allocation routine (bump-pointer) to hijack new so new objects land in a user allocator, builds an unsafe packed list that cuts insertion time from ~8–18s to under 3s, and hides trees from the GC to drop collection from ~30s to a few ms using WinDbg+SOS and emitted IL/dynamic methods.
AI-written summary · about
chapters (8)
- 0:00Introduction to talk
- 1:55Understanding object memory structure
- 9:04Demo 1: Allocating objects on stack
- 24:04Demo 2: Implementing unsafe list
- 30:27Demo 3: Custom memory allocator
- 33:56Hijacking operator new in .NET
- 42:22Demo 4: Improving GC performance
- 45:57Q&A and wrap-up
related talks
58mManual memory management in .NET Framework
57mWriting a custom, real-world .NET GC
50mLet’s refresh our memory! Memory management in .NET.
01h 00mMetaprogramming for the masses
01h 01mBoosting memory management in interoperability scenarios
01h 05mLook Mommy, No GC!
59mPragmatic memory management
57mMake your custom .NET GC — "whys" and "hows"
