Thanks to this book you will...

Become a better .NET programmer

And the Second Edition is coming!

  • 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
Why is it worth it?

What you will gain from this book

Knowledge

Dive deep into both the theoretical and practical aspects of how the Garbage Collection (GC) work in the .NET framework. This book explains the internals of memory management, giving you a comprehensive understanding of the underlying mechanisms.

Ideas

Empower your coding by learning multiple ways to enhance your application's performance. Learn from multiple scenarios to identify areas of improvement and implement effective solutions seamlessly. Get ideas for many smart tweaks!

Good practices

Master the art of efficient memory management by adopting proven best practices. Learn how to accurately measure memory usage, optimize allocations, and develop a proactive approach.
Content

See what's inside

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.

Chapters 7-10 🔥

Garbage Collection

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 11

GC Flavors

Describing all available GC modes with comprehensive considerations which one to choose.

Chapter 12

Lifetime management

Describing all available GC modes with comprehensive considerations which one to choose.

Chapter 13

Miscellaneous Topics

Explains the topic of managed pointers and goes deeper into structs (including recently added ref structs).

Chapter 14

(Really) Advanced Techniques

Puts a lot of attention to types and techniques gaining more and more popularity recently, like Span and Memory types.

Chapter 15

GC Flavors

Describes various ways how we can control and monitor the GC from code, including GC class API, CLR Hosting or ClrMD library.

Call to action

Buy or... wait!

The first edition (2018)

English version

Translated the first edition (2018)

Polish, Russian, Chinese

Or...

Wait until the Second Edition!

The planned release date for the book is mid-2024. Sign up for the newsletter if you would like to be kept informed of:

  • progress in book writing
  • interesting materials and posts from the authors
  • release date and pre-sales
  • occasional free material created by taking content out from the first edition
Authors

Find out more about the authors

Co-author

Kevin Gosse

Staff Software Engineer at Datadog

Kevin Gosse has been using Microsoft .NET technologies for 15 years, across client, server, and mobile applications. He is Microsoft MVP and is currently employed at Datadog, where he works on the performance of the .NET APM.

Co-author

Konrad Kokosa

CEO Crowdpub, co-founder spółki Dotnetos

Has been building a personal brand of nerd-programmer for years. Author of books. Partner in three companies in the field of online training, education and organising meetups and conferences.

Co-author

Christophe Nasarre

Microsoft MVP, developer and speaker

In addition to developing and shipping software on Microsoft stacks for 30+ years, Christophe has been working as a Technical Reviewer for MSPress, Addison-Wesley and other publishing companies since 1996 on books such as "CLR via C#" and the last editions of Windows Internals.

The second edition

How is the second edition of the book different?

The whole book has been very carefully reviewed by Konrad, Chris and Kevin. There was an update to .NET 8, whereas the first edition was written during the .NET Core 3.1 preview, solely by Konrad. These two extra pairs of eyes allowed us to look at the content of the book in a fresh way. We spent dozens of hours discussing changes to individual chapters. Sometimes debating the meaning of single words (perfectionism!😇)

In addition to the technical changes, we also looked very closely at style, grammatical errors and minor factual errors.

  • Updated to .NET 8
  • Covering the new CLI .NET tools like dotnet-trace
  • Fixed spelling and grammar errors
  • Improved style
  • Getting rid of some legacy content
  • Some parts were removed and published as free content (see below)
Free content

Parts removed from the first edition

Testimonials

What is being said about the first edition book?

If you use .NET and care about memory performance, or if you are just curious about the .NET GC and want to understand its inner workings, this is the book to get.

Maoni Stephens

Technical reviewer, Lead .NET GC developer @ Microsoft

Maoni's blog

All chapters provide a lot of detail that is very relevant and will provide the reader with a lot of "good knowledge" that they can put to use.

Damien Foggon

Technical reviewer

The best book about .NET runtime that I have read. Konrad goes through the basic assumptions of each application, such as a pile or stack, and then slowly goes to the meat. The chapters are completed with great summaries and usage examples that can help you understand the topic.

Łukasz

goodreads.com

Examples

Take a look inside

Frequently Asked Questions

The release date is currently planned for mid-2024. This will allow the latest .NET 8 framework to be included, taking into account the entire book release cycle.

It is over 1,000 pages packed with knowledge about memory management. Everything we know about it is contained there.

It depends on the translation. The heaviest is the original edition, in English, which weighs 2 kg (4.4 pounds) 😇