The full name of GC is Garbage Collection, Chinese name garbage recycling, is a feature of .NET's memory management. The garbage collector tracks and reclaims the object allocated in the hosted memory, regularly performs garbage collection to recover the memory that is not effectively referenced. When the memory request cannot be met using the available memory, the GC will be automatically performed.
When garbage collection, the garbage collector first searches for managed objects in memory, then search from the referenced objects in the hosted code and marks as valid, then releases that the memory is not marked as a valid object and retracts the memory, and finally consolidation memory will Effective objects move together. This is the four steps of GC.
It can be seen from the above, GC is very influential, so it is generally said that this kind of thing is still as possible.
In order to reduce some performance impact, .NET's GC support object aging, or the concept of independence, the generation is the measurement unit, an algex, or a generation of an algenever, or a period of the object. Currently .NET's garbage collector supports three generations. Each time the GC is performed, there is no recycled object to automatically improve the generation. Copy-created objects belong to a new generation, which is lower than the algebra of objects created earlier in the application lifecycle. The object in the middle of the rare is in zero. When each GC is time, the objects in the zero generation are first reclaimed, and only the more than the demand is still unable to meet the demand after the lower algebraic object recycling is completed.
Another: I can refer to Wang Yigang's article "garbage collection interest history", see http://www.contextfree.net/wangyg/b/tech_his/gc_history.html