Monday, 2 April 2012

What is the basic functionality of Garbage Collector in Microsft.Net?

The Common Language Runtime (CLR) requires that you create objects in the managed heap, but you do not have to bother with cleaning up the memory once the object goes out of the scope or is no longer needed. The Microsoft .NET Framework Garbage Collector provides memory management capabilities formanaged resources. The Garbage Collector frees objects that are not referenced and reclaims their memory. You should set your references to Nothing(null) as soon as you are done with them to ensure your objects are eligible for collection as soon as possible.
Here are the list of some tasks performed by the Garbage collector:
  • Garbage collector reserves a piece of memory as the application starts for the managed heap.
  • Garbage collector controls the managed heap memory currently used and available to an application.
  • Garbage collector allocates memory for new objects within the application.
  • The Garbage Collector attempts to reclaim the memory of objects that are not referenced.

No comments:

Post a Comment