ASP.NET Garbage Collector

Garbage collection in the Microsoft .NET common language runtime environment completely absolves the developer from tracking memory usage and knowing when to free memory.
In an object-oriented environment, every type identifies some resource available for your program's use. To use any of these resources requires that memory be allocated to represent the type. The steps required to access a resource are as follows:
  1. Allocate memory for the type that represents the resource.
  2. Initialize the memory to set the initial state of the resource and to make the resource usable.
  3. Use the resource by accessing the instance members of the type (repeat as necessary).
  4. Tear down the state of the resource to clean up.
  5. Free the memory.
The .NET common language runtime requires that all resources be allocated from the managed heap. This is similar to a C-runtime heap except that you never free objects from the managed heap objects are automatically freed when they are no longer needed by the application. This, of course, raises the question:

How does the managed heap know when an object is no longer in use by the application?
Click Here.
Fundamentals of Garbage Collections. Click Here.
Performance.Click Here

No comments: