Domanda di colloquio di Thermo Fisher Scientific

How does garbage collection work?

Risposta di colloquio

Anonimo

9 lug 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).