Chapter 7. Managed Memory Model

The first rule of management is delegation. Don’t try and do everything yourself, because you can’t.

Anthea Turner

In managed code, garbage collection is delegated to the Common Language Runtime (CLR). The Garbage Collector (GC) is a component of the CLR and responsible for managing managed memory. This chapter is a practical discussion of the Garbage Collector and the memory mode of the .NET Framework. In managed code, memory is allocated on demand for dynamic objects with the new operator. However, the Garbage Collector is responsible for freeing the memory for that object when necessary. There is no delete operator as in the C++ language.

In C++, the developer was responsible for managing dynamic memory. Dynamic ...

Get Solid Code: Optimizing the Software Development Life Cycle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.