We have an application where we process a long series of items (10,000 - up
to 1,000,000). Each item has a short time frame within which several
complicated processes MUST happen - An item passes a camera, and by the time
it reaches an ink sprayer, it must have been completely processed (around
10ms).
All in all C# performance is fine. However, the issue is the garbage
collector. It can pause the app, and cause problems -- when an item is missed
this is a big problem.
So, is it possible to:
a) Predict when the garbage collector is going to interrupt?
b) Turn off the Garbage Collector until a point is convenient to process?
If not, we have thought that we would periodically call:
GC.Collect(); GC.WaitForPendingFinalizers();
However, I'm not sure what the result of that would be - Is it still
possible that the GC might kick in, even though it is not low on memory? Or
because memory is fragmented (etc)?
Any thoughts or comments on dealing with this issue would be appreciated.