The .NET garbage collector is optimized for the following assumptions
1. Objects that were recently allocated are most likely to be freed.
2. Objects that have lived the longest are least likely to be become free.
3. Objects allocated together are often used together.
The .NET garbage collector is known as generational garbage collector. The objects allocated are categorized into three generations. Most recently allocated objects are placed in generation 0.
Objects in generation 0, that survive a garbage collection pass are moved to generation 1.
generation 2 contains long-lived objects, that survive after the two collection passes.
A garbage collection pass for generation 0 is the most common type of collection. Generation 1 collection pass is performed if generation 0 collection pass is not sufficient to reclaim memory.
Atlast, generation 2 collection pass is peformed if collection pass on generation 0 and 1 are not sufficient to reclaim memory. If no memory is available, after all the collection passes, an
OutOfMemoryException is thrown.
From:
Understanding Garbage Collection in C# Articles, samples and tutorials