An Introduction to .NET Memory Management

A .NET fact that has a lot of people interested, worried, or just plain dumbstruck is that .NET runtime memory management is a garbage-collected (GC) system. Old programmers in particular have nightmares about the days of Lisp, when waiting for the garbage collector was a painful experience because he only came on Tuesdays. C++ programmers have had memory management drummed in to them so hard that to relinquish control of those allocations and deletions is anathema to them.

The .NET memory management system approaches the allocation of memory resources differently. A block of memory allocated in the garbage collected or managed heap maintains a record of all the objects that refer to it. Only when those ...

Get C# and the .NET Framework: The C++ Perspective 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.