Hi....
I want to know, when and how garbage collector run in .net? Please tell me anyone ?
Thanks.........
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pravin MoreRank #1,419 · 1.2K reputationPosted Jan 10, 2012, 6:23 PM EST
Hi Vinit,
In .NET Garbage Collector maintained by CLR. The process of
GC is reclaim the memory of objets which is no longer
referenced by our program.Next thing is GC runs
undeterministicly because of that we can't assure we the
object will be released from the Heap Location.But the CLR
maintain a Logical Pointer to every object which referenced
by our program. In some amount of time the GC look out the
objects which is reachable from Logical Pointer. whatever
the object reachable from pointer it create a map those
objects. After that it will reclaim the memory of objects
those are not reachable from the pointer.This is the
process of how the GC clear the memory of Object.
Basically GC.Collect will work only if the memeory space is
less then required space.
You can force it to run by System.GC.Collect();
Thanks,
Pravin.
Mukesh KumarRank #615 · 3.9K reputationPosted Jan 10, 2012, 6:11 PM EST
See these links:
http://www.c-sharpcorner.com/uploadfile/skumaar_mca/garbage-collection-in-net-framework/
http://msdn.microsoft.com/en-us/magazine/bb985010.aspx
Satyapriya NayakRank #47 · 31.5K reputationPosted Jan 10, 2012, 6:37 PM EST
Please refer the below link
http://www.simple-talk.com/dotnet/.net-framework/understanding-garbage-collection-in-.net/
Thanks
Vineet Kumar SainiRank #257 · 9.8K reputationPosted Jan 10, 2012, 8:29 PM EST