Memory Leak caused by System.Drawing.Internal.GPStream

Somethings not being disposed of properly. Do you have warnings that say X class is iDisposable and you’re not disposing it? Look into using ‘using’ blocks.

See this :

“A FileStream involves unmanaged resources which could actually be immediately freed upon calling Dispose. A MemoryStream, on the other hand, stores a managed byte array in its _buffer variable, which is not freed at disposal time. In fact, the _buffer is not even nulled in the MemoryStream’s Dispose method, which is a SHAMEFUL BUG IMO because nulling the reference could make the memory eligible for GC right at disposal time. Instead, a lingering (but disposed) MemoryStream reference still holds onto memory. Therefore, once you dispose it, you should also null it if it’s still in scope.” – Triynko Oct 25 ’10 at 20:46

Is a memory leak created if a MemoryStream in .NET is not closed?