.NET Continuous Profiler: Memory usage | Datadog
May 20, 2024Christophe Nasarre

Summary
This post details the implementation of memory usage profiling in Datadog's .NET profiler. It covers monitoring garbage collector CPU impact by observing .NET Server GC threads, tracking allocations using the `AllocationTick` event (sampling every 100 KB), and monitoring surviving objects by leveraging `Weak` handles and the `ICorProfilerInfo13` API. It also addresses the challenge of upscaling sampled memory data by using size instead of duration, similar to lock contention profiling.