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.






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.







Finalize





Garbage Collector performance optimizations


•  Weak References

•  Generations


Weak References











Generations





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

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250