Memory & Garbage Collection
Trace ownership, understand CoreCLR GC, and investigate memory across managed runtimes.
- Reachability and object graphs
Follow references from an owner instead of equating a missing variable name with reclaimed memory.
Reachability · 18 min - Allocation, aliases, and value copies
Distinguish creating an object from copying a reference or copying a struct value.
Reachability · 18 min - Closures retain captured state
Follow a delegate through the variables it captures and the owner that stores it.
Reachability · 18 min - Events and listener retention
End an event subscription when the listening component no longer needs updates.
Reachability · 18 min - CoreCLR generations and promotion
Understand CoreCLR’s lifetime heuristic without imposing its generation model on every C# runtime.
Runtime architecture · 18 min - CoreCLR heap regions: SOH, LOH, and POH
Separate payload size from runtime-specific heap organization and public generation reporting.
Runtime architecture · 18 min - Fragmentation and free space
Distinguish releasing ownership from measuring contiguous free regions in a collector.
Runtime architecture · 18 min - Pinning and the pinned-object heap boundary
Use a bounded pinned handle without confusing it with a POH migration or an operating-system call.
Runtime architecture · 18 min - Finalization versus deterministic disposal
End owned resource work explicitly without pretending that Dispose frees managed object memory.
Ownership patterns · 18 min - SafeHandle ownership without native calls
Observe SafeHandle’s explicit cleanup protocol using a clearly labeled managed test token.
Ownership patterns · 18 min - Weak references are optional access
Use TryGetTarget without treating a weak reference as a guaranteed cache or cleanup signal.
Ownership patterns · 18 min - Static caches and explicit lifetime policies
Treat a static cache as a long-lived owner, not as automatically disposable temporary storage.
Ownership patterns · 18 min - Boxing and reference identity
Observe boxed value semantics before making allocation claims about generic or object-based APIs.
Ownership patterns · 18 min - ArrayPool leases and clearing policy
Use only the initialized logical prefix and return a rented buffer exactly once.
Ownership patterns · 18 min - Collection capacity and reuse
Separate current membership from reserved backing storage and retained element references.
Ownership patterns · 18 min - Measuring allocated bytes responsibly
Treat allocation deltas as target-specific observations rather than retained-memory totals.
Investigation · 18 min - A profiling plan starts with a reproducible workload
Instrument logical work before selecting target-specific memory tools.
Investigation · 18 min - What GC.Collect cannot fix
A requested collection does not make a strongly reachable object disappear.
Investigation · 18 min - CoreCLR, Mono/WebAssembly, and Unity
Record the execution profile before applying collector diagrams, measurements, or tooling assumptions.
Investigation · 18 min - A complete memory investigation workflow
Prove lifecycle behavior, identify retaining owners, and measure the actual target before claiming a fix.
Investigation · 18 min - Minor collections and old-to-young references
Trace a write barrier, distinguish a collection set from the full graph, and test an old owner with a young child.
Advanced Memory Investigations · 18 min - Retaining paths, cycles and dominators
Build an ownership graph, separate shallow from retained size, and identify independent roots.
Advanced Memory Investigations · 18 min - Async, callbacks and cancellation ownership
Follow captured state through pending work and end cancellation registrations at their real lifetime boundary.
Advanced Memory Investigations · 18 min - LOH allocation, fragmentation and compaction evidence
Separate payload length, object size, free gaps and committed memory before tuning large allocations.
Advanced Memory Investigations · 18 min - Pinned lifetimes and the pinned-object heap
Separate strong ownership, pin duration, POH allocation and native pointer validity.
Advanced Memory Investigations · 18 min - Finalizer queues, resurrection and disposal
Separate eligibility, finalizer execution, graph retention and deterministic resource release.
Advanced Memory Investigations · 18 min - Span, Memory and hidden backing-store retention
Expose the difference between a view, a copy, an owner and a valid buffer lease.
Advanced Memory Investigations · 18 min - Pool leases, clearing and exception paths
Return rented buffers exactly once, expose logical lengths and include retained pool capacity in the budget.
Advanced Memory Investigations · 18 min - Measure allocations without confusing live memory
Warm the code, keep the measured work synchronous, and separate allocation throughput from retention.
Advanced Memory Investigations · 18 min - Backpressure is a memory ownership policy
Budget active and queued payloads, acquire admission before allocating and release every cancelled lease.
Advanced Memory Investigations · 18 min - GC modes, DATAS and container budgets
Read effective runtime settings and distinguish a managed heap limit from a whole-process memory limit.
Advanced Memory Investigations · 18 min - A complete memory incident investigation
Correlate counters, surviving types, retaining paths, native memory and latency before choosing a fix.
Advanced Memory Investigations · 18 min