- 1072 pages full of content
- 293 figures and 476 listings helping to illustrate
- 25 Scenarios - practical advices how to diagnose various memory problems
- 26 Rules - how to write good memory-aware code and avoid common pitfals.
Thoroughly reviewed by Maoni Stephens
the lead .NET GC developer @ Microsoft and other .NET team members: Stephen Toub, Jared Parsons,
Cwalina, Lee Culver, Josh Free and Omar Tawfik. Also by Mark Probst @ Xamarin (notes about Mono
and Damien Foggon
I love drawing so making figures was the one of the most pleasant activities while writing this
book. As a free bonus, I've prepared .NET Memory
Management poster completely for free, just for fun of mine and yours! See
and download it below.
General theoretical introduction to memory management, with almost no reference to .NET in
Low-Level Memory Management
Introduction to memory management on the hardware and operating system level.
Solely dedicated to measurements and various tools (among which some are very often used later in
Describes relevant internals like .NET type system (including value type versus reference type),
string interning or static
How memory is organized in .NET applications, introducing concept of Small and Large Object Heap,
generations as well as segments.
Dedicated solely to allocating memory. An important part of this chapter is description of various
sources of allocations,
in the context of avoiding them.
Garbage Collection - Introduction
Introduction to the description of the GC implementation in .NET, including a description of the
steps performed, what triggers
it, and choosing the generation to be collected.
Garbage Collection- Mark Phase
Description of the GC mark phase, discovering what may be garbage collected, including comrehensive
guide of various types of GC
Garbage Collection- Plan Phase
Description of the GC planning phase, including details about plugs, gaps, demotion and choosing
between compaction and sweeping.
Garbage Collection- Sweep and Compact
Description of the last GC phase, how both compaction and sweeping are performed with the knowledge
from the previous phase.
Describing all available GC modes with comprehensive considerations which one to choose.
Describing resource managment-related mechanisms: finalization, disposable objects and weak
Explains the topic of managed pointers and goes deeper into structs (including recently added ref
Puts a lot of attention to types and techniques gaining more and more popularity recently, like
Describes various ways how we can control and monitor the GC from code, including
class API, CLR Hosting or ClrMD library.
Designed to be printed in A3 format. Although they contain a lot of information, everything cannot
be explained on single
graph, obviously. Nevertheless, after reading the book everything will be clear and in place!