1. Back To Blog

C# Interview questions :- Explain generations ( GC 0 , GC 1 and GC 2) in .NET?

Generations defined how the old the objects are alive in memory.


So if the object is freshly created its in generation 0 ( gen 0). If after some time garbage collector (GC) is not able to reclaim it , its moved to generation 1 ( gen 1). If the object stays in memory for a more longer time then its shifted to Generation 2( gen 2).


There are only three generations. So more the object is old the more it goes to higher generation bucket.


Below is a nice youtube video which explains the .NET Garbage collector and generation concept in more detail


Shiv Prasad Koirala

Visit us @ www.questpond.com or call us at 022-66752917... read more

We are on Social