C# Garbage Collection
When a dot net application runs, lots of objects are created. At a given point in time, it is possible that some of those objects are not used by the application. Garbage Collector in .NET Framework is nothing but a Small Routine or you can say it’s a Background Process Thread that runs periodically and try to identify what objects are not being used currently by the application and de-allocates the memory of those objects. So, Garbage Collector is nothing but, it is a feature provided by CLR which helps us to clean or destroy unused managed objects. Cleaning or destroying those unused managed objects basically reclaim the memory. Note : The Garbage Collector will destroy only the unused managed objects. It does not clean unmanaged objects. Generations - The GC algorithm is based on several considerations: - It's faster to compact the memory for a portion of the managed heap than for the entire managed heap. - Newer objects have shorter lifetimes, and older objects have longer lif...