Google News
logo
C# - Interview Questions
What is garbage collection in C#?
Garbage collection is the process of freeing up memory that is captured by unwanted objects. When you create a class object, automatically some memory space is allocated to the object in the heap memory. Now, after you perform all the actions on the object, the memory space occupied by the object becomes waste. It is necessary to free up memory. Garbage collection happens in three cases :
 
* If the occupied memory by the objects exceeds the pre-set threshold value.
* If the garbage collection method is called
* If your system has low physical memory
Advertisement