The general advise is that you should not call GC.Collect
from your code, but what are the exceptions to this rule?
I can only think of a few very speci
If you are creating a lot of new System.Drawing.Bitmap
objects, the Garbage Collector doesn't clear them. Eventually GDI+ will think you are running out of memory and will throw a "The parameter is not valid" exception. Calling GC.Collect()
every so often (not too often!) seems to resolve this issue.