I have situation when GC has no time to delete free objects. The code loads a large document into memory and processes it in a loop. If I stop in this loop (in debug mode) or add GC.Collect() the memory usage drops to less then 70 MB.
How do I tune GC? Are there any best practices for tuning GC?
The best tuning here is to leave it alone.
But if your process is really blocking the GC all the time (it shouldn’t), it could help to call
GC.Collect()after some memory consuming part finishes.But we need a lot more info here. What type of application, why (do you think) the GC has no time to do it normally?