I have an application where I am taking a bitmap and compressing it using a GZipStream and sending it over a socket, all in memory. I have tracked down the dirty scumbag mem
Okay, after trying everyones ideas and thoughts and numerous other methods. I finally tried the simple:
using (frame) {
frame.Save(outStream, jpegCodec, parameters);
}
And well, this worked and the memory leak is fixed.. I tried forcefully invoking the garbage collector, disposing the bitmap manually, using P/Invoke DeleteObject, nothing worked, but using a using statement did. So this makes me wonder what happens underthehood on a using statement that I'm missing out on....