O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Garbage Collection Algorithm

The garbage collector checks to see whether there are any objects in the heap that are no longer being used by the application. If such objects exist, the memory used by these objects can be reclaimed. (If no more memory is available in the heap, then new throws an OutOfMemoryException exception.) How does the garbage collector know whether or not the application is using an object? As you might imagine, this isn’t a simple question to answer.

Every application has a set of roots. A single root is a storage location containing a memory pointer to a reference type. This pointer either refers to an object in the managed heap or is set to null. For example, all global or static reference type variables are considered ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required