I have a List<> with about 800,000 objects in it. Once I’m done with this list, I set it to null and then proceed with the rest of the routine.
The problem is the .NET’s garbage collector does not seem to be doing its job fast enough because when after setting this list to null, memory usage stays the same and I get “out of memory” exceptions.
Is there a way to wait on the garbage collector to finish its job ?
Perhaps I could redesign my program so I don’t load 800,000 items at once but this is for a one time running program that’s not going to be use in production at all.
Thanks!
You could call:
However, I’d really only do this as a test to see if it helps and to establish if the
GCis the problem.I’m assuming you have tested things in both
DebugandReleasemodes.As a final note, you could potentially look at changing the GC Latency Mode.