Question d’entretien chez Thermo Fisher Scientific

How does garbage collection work?

Réponse à la question d'entretien

Utilisateur anonyme

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