Garbage Collection is a technique introduced in Microsoft .NET that manages memory automatically.
The runtime manages application threading, providing application memory isolation. When objects are no longer used by a .NET application, the runtime performs garbage collection, which frees up the memory that was used by those objects. NET uses the information in the metadata to trace the object graph and detect the objects that need to be garbage collected. Objects that are not reachable from the root are referred to as garbage objects and are marked for garbage collection.
It prevents memory leaks caused by the application that do not release all resources.
We should import System.GC Namespace to implement any garbage collector methods manully in the code.
Garbage collector is applicable only for the managed code.
Some of the methods of Garbage Collector.
GC.Collect Method
Used to force a garbage collection .
GC.GetTotalMemory
returns the total number of bytes that is allocated in the managed memory
GC.KeepAlive Extends the life time of an object passed to it as a parameter
GC.ReRegisterForFinalize
re-registers an object for finalization which is sent as parameter
GC.SupressFinalize
Suppress the finalization on an object.
Friday, January 23, 2009
Subscribe to:
Post Comments (Atom)
Mam., if you could update us the latest in Asp.net as Like Silverlight,Ajax..
ReplyDeletethanks in advance
Hi Asif,
ReplyDeleteSorry for delay,these days i dont get time to work on blog .
so many people asked me for the latest topics.I will do my best to update every one on latest topics .
thanks a lot mam
ReplyDelete