What is garbage collection?
manages allocation and release of memory for the application. When any application starts, it initializes objects. Common language runtime allocates memory from managed heap when a new object in being initialized. CLR keep initializing memory for all the applications. As the computer memory is limited so its garbage collectors job to free up some memory. Garbage collector's optimizing engine determines which is the best time to clean memory. Garbage collector frees up memory by removing the object that are not in use.