Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
When should we call gc.Collect() manually in asp.net ???
Thanks in advance.
Posted
Comments
RakeshMeena 15-Jul-11 2:51am    
What is it that you want to achieve here?

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Jul-11 3:08am    
The advices in this article are reasonable, my 5. I actually explained advice #1, which is most important (please see my solution). There can be some more situations where a call to GC might slightly improve things. Still using it is questionable, needs some real research in each concrete case.
--SA
arathi_suresh 15-Jul-11 3:27am    
my +5 for you too Prerak
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Jul-11 3:11am    
The referenced articles provide good points, my 5. Please also see my comment to the solution by Prerak (his link is included in yours anyway) and my solution.
--SA
arathi_suresh 15-Jul-11 3:23am    
Thanks SAKryukov
I recommend not to use GC (http://msdn.microsoft.com/en-us/library/system.gc.aspx[^]) at all unless you understand very well how Garbage Collector works and find a really good reason to use it. Normally, Garbage Collector works quite well without any calls to GC.

As you're asking this question, you're certainly not the one who understand it so well and get an idea how and why to use GC explicitly. Conclusion: you should not do it.

—SA
 
Share this answer
 
Comments
arathi_suresh 15-Jul-11 3:24am    
My +5. I am a fan of you!
Sergey Alexandrovich Kryukov 19-Jul-11 0:42am    
Wow... Thank you for your good words, Arathi.
--SA

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