C# Interview questions :- Explain generations ( GC 0 , GC 1 and GC 2) in .NET?
- By Shiv Prasad Koirala in C#
- Nov 25th, 2016
- 24387
- 0
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.
Here is a nice youtube video which explains the .NET Garbage collector and generation concept in more detail.
Do not forget to watch below C#(CSharp) interview questions and answers series :-
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more