GC as we know that, it is used for removing unmanaged object or resources from the HEAP, those are no longer used in our code. Garbage Collector works in 3 phases:-
1). Generation Zero -> In this phase, once an OBJECT is created or initialized, it will come into generation 0 phase.
2). Generation One -> Once created object comes under GC process, then that object will be treated in Generation one phase.
3). Generation Two -> Once any NEW OBJECT is created and added into HEAP, they are added into Generation ) phase and the old objects in Generation 1 are considered to be in Generation 2.
Asked In: Many Interviews |