Sollicitatievraag bij Thermo Fisher Scientific

How does garbage collection work?

Antwoord op sollicitatievraag

Anoniem

9 jul 2010

Very briefly: The .NET Garbage Collection (GC) sorts the objects by generations (3 total). The lower the generation the more frequently it is checked. During each pass, if an object is referred to by any other object/method GC promotes it to higher generation. Otherwise, it is either destroyed, or marked as needing finalization (will be finalized and destroyed during next pass).