what is the use of GC.Collect() and how can i use it efficen
what is the use of GC.Collect() and how can i use it efficiently.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Biswa Pujarini MohapatraPosted Feb 25, 2014, 12:12 AM
Sanjay DholakiyaPosted Feb 26, 2014, 11:05 PM
Hi,
GC does automatic memory management and handles object's cleanup allocated on heap memory area.
No one can say when the garbage collection will be called to claim the memory for those objects that are no longer in use.
Therefore, you can use GC.Collect() method to force the framework to start garbage collection task. To call GC.Collection method explicitly is not a very good idea because let allow the framework to do its work in it's own way. You can call, however, to suit some particular requirement.
For more.... http://msdn.microsoft.com/en-us/library/xe0c2357(v=vs.110).aspx
- Sanjay Dholakiya
Ranjit PowarPosted Feb 25, 2014, 12:14 AM