A common scenario when running out of memory is that some object is blocking the finalizer queue for .Net. And all objects that should be finalized is just queued up and allocates memory.
Detect the problem
List objects in finalizer queue
The easy way with
Process explorer
or the hard way with
WinDbg.
If you take several snapshots and see the queue grows it can be a blocking finalizer, the most common issue with this is that
1) The using statement isn’t used for a object that implements IDisposable
2) The IDisposable interface is not implemented correctly, propebly the Dispose method
dosen't execute the method GC.SuppressFinalize() as in the
example
Solution
Allways use the
IDisposable pattern when creating objects that implements
IDisposable