For .NET developers
Mastering Memory Management and Garbage Collection in .NET
Connect .NET garbage collection, allocation, ownership, and pooling to practical memory and performance decisions.
Start with a lesson that meets you where you are.
Try questions to check what you understand.
Sign in to keep your practice progress together.
Your learning path
26 of 78 topics have lessons available today. Choose any available lesson.
- 01
Memory Fundamentals
Read the lesson, then try the practice.
- 02
Stack Allocation
Read the lesson, then try the practice.
- 03
Stackalloc and Span<T>
Read the lesson, then try the practice.
- 04
Heap Allocation
Read the lesson, then try the practice.
- 05
Object header and layout
Read the lesson, then try the practice.
- 06
Value vs Reference Types
Read the lesson, then try the practice.
- 07
Boxing and unboxing
Read the lesson, then try the practice.
- 08
Garbage Collection Fundamentals
Read the lesson, then try the practice.
- 09
Generational Model
Read the lesson, then try the practice.
- 10
GC Roots and Tracing
Read the lesson, then try the practice.
- 11
Collection Triggers
Read the lesson, then try the practice.
- 12
GC Modes and Adaptive Behavior
Read the lesson, then try the practice.
- 13
Workstation vs Server GC
Read the lesson, then try the practice.
- 14
Background and Concurrent GC
Read the lesson, then try the practice.
- 15
DATAS
Read the lesson, then try the practice.
- 16
Retention Bugs in Managed Code
Read the lesson, then try the practice.
- 17
Diagnostic Techniques
Read the lesson, then try the practice.
- 18
Modern Allocation Primitives
Read the lesson, then try the practice.
- 19
Span<T> and ReadOnlySpan<T>
Read the lesson, then try the practice.
- 20
Memory<T> and ReadOnlyMemory<T>
Read the lesson, then try the practice.
- 21
Safe vs Unsafe Patterns
Read the lesson, then try the practice.
- 22
Span escape analysis
Read the lesson, then try the practice.
- 23
Buffer Ownership and Pooling
Read the lesson, then try the practice.
- 24
ArrayPool<T>
Read the lesson, then try the practice.
- 25
IBufferWriter<T> and Writers
Read the lesson, then try the practice.
- 26
ReadOnlySequence<T>
Read the lesson, then try the practice.
Topics without lessons yet
These are part of the outline. Lessons are not available for them yet.
- Stack frame lifecycle
- Stack limitations
- Small Object Heap (SOH)
- Large Object Heap (LOH)
- Struct semantics
- Reference type overhead
- Gen0 ephemeral collection
- Promotion mechanics
- Gen2 and full collections
- Root types
- Mark and sweep
- Finalization pipeline
- Allocation threshold
- Induced collections
- Memory pressure signals
- Workstation GC
- Server GC
- Choosing the right mode
- Background GC mechanics
- Foreground vs background pauses
- Non-concurrent workstation fallback
- Allocation rate feedback
- Latency vs throughput decisions
- What DATAS doesn't change
- Event Handler Leaks
- Strong references via delegates
- Unsubscribe patterns
- Static event anti-pattern
- Cache and Collection Leaks
- Unbounded static caches
- Dictionary key retention
- TimerQueue and callback leaks
- Memory snapshots and diffs
- Shortest root path analysis
- GC event traces
- ref struct constraints
- Slicing without allocation
- stackalloc integration
- Async method compatibility
- MemoryManager<T> backing
- Field storage and lifetime
- Use-after-free prevention
- Unsafe buffer access
- Rent and return discipline
- Shared vs custom pools
- Array size bucketing
- IBufferWriter<T> contract
- ArrayBufferWriter<T>
- Custom writer implementations
- Segment-based enumeration
- SequenceReader<T>
- Position and slicing