How many types of generations are there in a garbage collector?
Memory management in the CLR is separated into three generations that are building up by grouping memory segments. Generations increase the garbage collection performance. The following are the three types of generations found in a garbage collector:
Generation 0 - When an object is initialized, it is said to be in generation 0.
Generation 1 - The objects that are under garbage collection process are considered to be in generation 1.
Generation 2 - Whenever new objects are formed and added to the memory, they are added to generation 0 and the old objects in generation 1 are considered to be in generation 2.