-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: AnujAhuja
Message 2 in Discussion

Garbage collection in .NET is done using tracing collection and specifically the CLR 
implements the Mark/Compact collector.  Mark
When the garbage collector starts running, it makes the assumption that all objects in 
the heap are garbage. In other words, it assumes that none of the application's roots 
refer to any objects in the heap .Once all the roots have been checked, the garbage 
collector's graph contains the set of all objects that are somehow reachable from the 
application's roots; any objects that are not in the graph are not accessible by the 
application, and are therefore considered garbage.  Compact 
Move all the live objects to the bottom of the heap, leaving free space at the top.   
Finalization Whenever a new object, having a Finalize method, is allocated on the heap 
a pointer to the object is placed in an internal data structure called Finalization 
queue. When an object is not reachable, the garbage collector considers the object 
garbage. The garbage collector scans the finalization queue looking for pointers to 
these objects. When a pointer is found, the pointer is removed from the finalization 
queue and appended to another internal data structure called Freachable queue, making 
the object no longer a part of the garbage. At this point, the garbage collector has 
finished identifying garbage. The garbage collector compacts the reclaimable memory 
and the special runtime thread empties the freachable queue, executing each object's 
Finalize method.  The next time the garbage collector is invoked, it sees that the 
finalized objects are truly garbage and the memory for those objects is then, simply 
freed.  Thus when an object requires finalization, it dies, then lives (resurrects) 
and finally dies again. It is recommended to avoid using Finalize method, unless 
required. Finalize methods increase memory pressure by not letting the memory and the 
resources used by that object to be released, until two garbage collections. Since you 
do not have control on the order in which the finalize methods are executed, it may 
lead to unpredictable results.  
for more information
see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetgcbasics.asp
 Regards - Anuj

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to