Click here to Skip to main content
16,021,169 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How garbage collector works in deep with explaining each phase in detail?
Posted

Seems like you are looking for in detailed working of Garbage collector.

The .NET Framework's garbage collector manages the allocation and release of memory for your application. Each time you create a new object, the common language runtime allocates memory for the object from the managed heap. As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made. When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.

Please refer to wikipedia for the basics. http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)[^]

Now after having the basics of Garbage collection, Have a look at how it works with .net
http://msdn.microsoft.com/en-us/library/0xy59wtx.aspx[^]
 
Share this answer
 
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

There are lots, and lots of explanations out there that Google can find - try the one on MSDN first, and work from there.
 
Share this answer
 
In short:
The Garbage Collector (GC) can be considered the heart of the .NET Framework.
It manages the allocation and release of memory for any .NET application.
In order to create good .NET applications.
Here are some good links to start with:
How the Garbage Collector works - Part 1[^]
How the Garbage Collector works - Part 2[^]


Please refer some more links, for detailed description:
Garbage Collector Basics and Performance Hints[^]

Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework[^]

How does garbage collection and scoping work in C#?[^]
How garbage collection works on object references?[^]
 
Share this answer
 

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