Click here to Skip to main content
15,031,085 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
:-) hi

When will GC decided that an object is dead or what are the criteria for judging an object is a dead object?

Thanks in advance
Posted

   
v2
Comments
Tarun.K.S 30-Jun-11 6:02am
   
Excellent articles there. Just added another article by him. Bookmarked your answer for future reference. :)
5+
Prerak Patel 30-Jun-11 6:05am
   
Thanks Tarun. The link you provided is part 2 of the second link, ofcourse, a good reference.
I would also to like add on with the other excellent answers. Check out these classy articles which will give you a better idea:

- Implementing IDisposable and the Dispose Pattern Properly[^]

- IDisposable: What Your Mother Never Told You About Resource Deallocation[^]
   
Comments
Abhinav S 30-Jun-11 10:32am
   
Good links. 5.
Tarun.K.S 30-Jun-11 10:42am
   
Thanks! :)
AFAIK, the GC maintains a tree with nodes on it (for all objects).
When there a node without any references, that object is ready for garbage collection.
   
v2
Comments
Tarun.K.S 30-Jun-11 6:03am
   
Yep right. I think objects are placed in 3 generations and shorter lived objects are placed in lower generations so that GC collect them quickly. 5+
Abhinav S 30-Jun-11 10:31am
   
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900