Chapter 8. Understanding Object Lifetime

At this point in the text, you have learned a great deal about how to build custom class types using C#. Here, you will come to understand how the CLR is managing allocated objects via garbage collection. C# programmers never directly deallocate a managed object from memory (recall there is no delete keyword in the C# language). Rather, .NET objects are allocated onto a region of memory termed the managed heap, where they will be automatically destroyed by the garbage collector "sometime in the future."

Once you have examined the core details of the collection process, you will learn how to programmatically interact with the garbage collector using the System.GC class type. Next you examine how the virtual ...

Get Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition 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.