Articles → .NET → Garbage Collector

Garbage Collector

•  Allocate memory to resource.

•  Initialize the memory to set the initial state of the resource.

•  Use the resource.

•  Tear down the state of the resource.

•  Free the memory.

Picture showing the pictorical representation of Managed Heap

Click to Enlarge

Application roots

Phase I: Mark - Find the memory that can be reclaimed.

•  GC identifies live application roots.

•  It starts walking the roots and graph all the objects reachable from the roots.The objects that are not reachable through the application roots is considered as garbage.

Phase II: Compact - Move all the live objects to the bottom of the heap, leaving free space at the top.


Garbage Collector performance optimizations

•  Weak References

•  Generations

Weak References


Posted By  -  Karan Gupta
Posted On  -  Thursday, June 10, 2010


Your Email Id  
Query/FeedbackCharacters remaining 250