Garbage Collection


The .NET Framework's garbage collector manages the allocation and release of memory for your application. Each time you create a new object, the common language runtime allocates memory for the object from the managed heap. As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made. When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.

Fundamentals of Garbage CollectionDescribes how garbage collection works, how objects are allocated on the managed heap, and other core concepts.
Garbage Collection and PerformanceDescribes the performance checks you can use to diagnose garbage collection and performance issues.
Induced CollectionsDescribes how to make a garbage collection occur.
Latency ModesDescribes the modes that determine the intrusiveness of garbage collection.
Optimization for Shared Web HostingDescribes how to optimize garbage collection on servers shared by several small Web sites.
Garbage Collection NotificationsDescribes how to determine when a full garbage collection is approaching and when it has completed.
Application Domain Resource MonitoringDescribes how to monitor CPU and memory usage by an application domain.
Weak ReferencesDescribes features that permit the garbage collector to collect an object while still allowing the application to access that object.









Cleaning Up Unmanaged Resources