Saturday, June 8, 2013

Advantages of Garbage Collector

The Garbage Collector does automatic memory management for application running in the .Net. The Garbage Collector makes sure that it reclaims unused memory and provides it the new objects which get created as the program runs.

We know that all the reference type objects are stored in the Heap and it does not get cleared by itself, the garbage collector monitors the state of the heap and removes unused objects to reclaim the memory used by those objects.

The following are the advantages of Garbage Collector.

1.The programmers need not worry about allocation and disposal of memory for the objects, they can focus on the business logic since the Garbage Collector takes care of allocating and disposing objects from the Managed Heap.

2.The Garbage Collector uses a series of algorithms to allocate and dispose objects in the most efficient way, this makes sure that the available memory space is used in the most efficient way to improve performance of the application.

3.The Garbage Collector tags objects using generation logic, this makes sure that the recently created objects are not disposed. The generation logic makes sure that only objects which are not used for a longer time gets disposed, thereby reduces the overhead of re-creating which are frequently used.

4. The Garbage Collector keeps track of global and static objects and ensures that they are not destroyed, these object will be maintained in the memory as long as the application runs, since they can be called anywhere at any point of application execution without creating an instance.



Search Flipkart Products:
Flipkart.com