Numbers
- 1072 pages full of content
- 293 figures and 476 listings helping to illustrate
presented
material
- 25 Scenarios - practical advices how to diagnose various memory problems
- 26 Rules - how to write good memory-aware code and avoid common pitfals.
Words
Thoroughly reviewed by
Maoni Stephens,
the lead .NET GC developer @ Microsoft and other .NET team members: Stephen Toub, Jared Parsons,
Krzysztof
Cwalina, Lee Culver, Josh Free and Omar Tawfik. Also by Mark Probst @ Xamarin (notes about Mono
runtime)
and
Damien Foggon
@ Apress.
Pictures
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.
Chapter 1
Basic Concepts
General theoretical introduction to memory management, with almost no reference to .NET in
particular.
Chapter 2
Low-Level Memory Management
Introduction to memory management on the hardware and operating system level.
Chapter 3
Memory Measurements
Solely dedicated to measurements and various tools (among which some are very often used later in
the book).
Chapter 4
.NET Fundamentals
Describes relevant internals like .NET type system (including value type versus reference type),
string interning or static
data.
Chapter 5
Memory Partitioning
How memory is organized in .NET applications, introducing concept of Small and Large Object Heap,
generations as well as segments.
Chapter 6
Memory Allocation
Dedicated solely to allocating memory. An important part of this chapter is description of various
sources of allocations,
in the context of avoiding them.
Chapter 7
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.
Chapter 8
Garbage Collection- Mark Phase
Description of the GC mark phase, discovering what may be garbage collected, including comrehensive
guide of various types of GC
roots.
Chapter 9
Garbage Collection- Plan Phase
Description of the GC planning phase, including details about plugs, gaps, demotion and choosing
between compaction and sweeping.
Chapter 10
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.
Chapter 11
GC Flavors
Describing all available GC modes with comprehensive considerations which one to choose.
Chapter 12
Lifetime management
Describing resource managment-related mechanisms: finalization, disposable objects and weak
references.
Chapter 13
Miscellaneous Topics
Explains the topic of managed pointers and goes deeper into structs (including recently added ref
structs).
Chapter 14
Advanced Techniques
Puts a lot of attention to types and techniques gaining more and more popularity recently, like
Span<T>
and
Memory<T>
types.
Chapter 15
Programmatical APIs
Describes various ways how we can control and monitor the GC from code, including GC
class API, CLR Hosting or ClrMD library.
Posters (free!)
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!