As we all knows the .NET garbage collector provides a high-speed allocation service with good use of memory and no long-term fragmentation problems.
This article explains the generation of the GC.
When an object is created it will be on managed head. The managed heap are devided in mainly 3 groups, that are based on the age of variable. These is called Generations. Its useful to previent memory leak on managed heap. As far as performance is concern GC search the dead object on each of these generation at a time.
So lets see these groups [generations]
1. Gen0 [Generation 0]
The objects falles under this category are short leaving, and they are on the top zone of heap. GC is quick to collect and get them destroid, so this swipe is more ofen to release the memory space.
2. Gen1 [Generation 1]
It contains all the living objects from Gen0 that have survived to several Gen0 collects. That means they are upgraded from Generation 0 to Generation 1!!. The zone of Gen1 is in the middle of the heap and so the swipe is less then Gen0
3. Gen2 [Generation 2]
The last group which contains all the living objects from Gen1 that have survived to several Gen2 collects. The age of these object are logner then all and its expensive to destory them, by this reason GC will hardly swipe this area. Its in the lowest memore zone of the heap that is at the bottom.
Read more : Framework-Internals
22 hours ago