Reasons why one should not call the garbage collector directly.

Posted by Shimrod on Stack Overflow See other posts from Stack Overflow or by Shimrod
Published on 2010-06-16T10:16:11Z Indexed on 2010/06/16 10:22 UTC
Read the original article Hit count: 402

Hi everyone,

I'm currently writing a paper for my company, about how to avoid calling the garbage collector directly from the code (when playing with COM objects for instance).

I know this is a bad practice, and should be only considered in very rare cases, but I can't seem to find a way to tell why it should be avoided. And I don't want to rely on the "The G.C. is smarter than you" principle (even if it is the truth :-) )

So can you tell me some clues about why you think one should avoid to call the garbage collector directly ? (performance impact?) Or maybe if you have links about this particular topic, they would be very helpful.

Thanks in advance !

© Stack Overflow or respective owner

Related posts about .NET

Related posts about garbage-collection