How does Garbage Collector works?

 Posted by vishalneeraj-24503 on 11/6/2013 | Category: Interview Questions Interview questions | Views: 4003 | Points: 40
Answer:

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 | Alert Moderator 

Comments or Responses

Login to post response

More Interview Questions by vishalneeraj-24503