Become a better .NET programmer, gain the knowledge about memory management!

  • Understand how and why memory is managed by .NET runtime
  • Learn how to write memory-aware code
  • Explore various aspects of advanced memory management
  • Learn how to monitor and diagnose various memory related problems
  • Learn the details of GC implementations not published anywhere else

About the book

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.

Testimonials

Table of Contents

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!

About the author

Programming for over a dozen years, solving performance problems and architectural puzzles in the .NET world, speeding up web applications. Independent consultant, blogger, speaker and fan of Twitter. He also shares his passion as a trainer at Bottega IT Solutions in the area of .NET, especialy about application performance and diagnostics. Founder of the Warsaw Web Performance group. Microsoft MVP in the Visual Studio and Development Tools category. Co-founder of https://dotnetos.org initiative.

Buy the book

Trainings and consultancy

Online consultancy

You have read the book but you still have some questions or doubts? I invite you to the online consultancy with me. During few hours session (i.e. on Skype, Zoom or any other media) we will go through all your questions, in your individual, personalized context!
The offer is addressed only to individuals.

On-site trainings

Do you want to provide even deeper knowledge about .NET memory management for your team? Please, feel free to invite me to make 2-3 on-site training at your company. The training program will be individually tailored to the needs of your company.
The offer is addressed only to companies.
If you are interested, please fill in the contact form below!

Contact

Feel free to contact me in any matter - both criticism and praise of the book!
. All rights reserved to Gritstep.
Icons made by Prosymbols from www.flaticon.com is licensed by CC 3.0 BY