Memory Management a part of CLR functionality is a important aspect in .NET.
Garbage Collector well known as GC is the one responsible for Memory Management.
GC Runs periodically through Managed Heap (Which is divided into 3
Generations) and find the object which doesn't contain any reference. It then
collect those objects to free Managed Heap. After collecting the unreferenced
object GC will then Defragment Managed Heap in order to get continuous block of
memory.
GC.Collect() is a method used to call GC exclusively. However it is
recommended not to use this method often as it will promote the object left in
Heap to higher generation.