What is Garbage Collection in c#
- Garbage collection is the mechanism that reclaims the memory resources of an object when it is no longer referenced by a variable.
- .Net Runtime performs automatically performs garbage collection, however you can force the garbage collection to run at a certain point in your code by calling System.GC.Collect().
- Advantage of Garbage collection : It prevents programming error that could otherwise occur by incorrectly deleting or failing to delete objects.
Comments