C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




details about garbage collector


Posted Date: 16 Aug 2006      Total Responses: 3

Posted By: gogula       Member Level: Bronze     Points: 2


please give me complete descripton about garbage collector right from how it will be invoked and hw it is going to free the memory of unused objects in detail.



Responses

Author: ravindrababu.k    16 Aug 2006Member Level: GoldRating:     Points: 2
http://www.codeproject.com/dotnet/garbagecollection.asp


Author: Dotnetjunkie    16 Aug 2006Member Level: GoldRating:     Points: 2
Hello
GC is invoked automatically and we can also force to run at any time by calling the function Collect();
GC has the 2 phases starting from 0,1
in first phase 0, it will Marked the unused memory
in 1st phase, Move all the live objects to the bottom of the heap, leaving free space at the top.

and for more help
For Automatic free memory management ::::
http://msdn.microsoft.com/msdnmag/issues/1100/gci/




Author: Vikram Singh Kshatriya    16 Aug 2006Member Level: GoldRating:     Points: 2
The GC Class controls the system garbage collector, a service that automatically reclaims unused memory.
Garbage collection in the Microsoft .NET common language runtime environment completely absolves the developer from tracking memory usage and knowing when to free memory. However, you'll want to understand how it works.
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. Now, the garbage collector starts walking the roots and building a graph of all objects reachable from the roots.
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. The garbage collector now walks through the heap linearly, looking for contiguous blocks of garbage objects (now considered free space). The garbage collector then shifts the non-garbage objects down in memory (using the standard memcpy function that you've known for years), removing all of the gaps in the heap. Of course, moving the objects in memory invalidates all pointers to the objects. So the garbage collector must modify the application's roots so that the pointers point to the objects' new locations. In addition, if any object contains a pointer to another object, the garbage collector is responsible for correcting these pointers as well.


Post Reply
You must Sign In to post a response.
Next : Exit from project
Previous : how to chage the forecolor of text in the dropdownlist using javascript
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

internet fax

Contact Us    Privacy Policy    Terms Of Use