I do not work for RedGate nor associated with this vendor in anyway. I was pleasantly surprised when I had to use their memory profiler “Ants profiler” to resolve some major memory leaks issues.
Most of those issues were caused by passing MemoryStreams all over the place; of course streams cannot be closed if we want to pass them to around.
No code reviews were done and the whole project didn’t have more than 100 unit test “we are in 2010?” once the app went to full test using LoadRunner those open streams brought to the server to its knees in less than 5 minutes with our of memory exceptions.
We could have spent days looking for all of those open streams other causes if it wasn’t for Ants profiler.
I strongly recommend this tool for anyone developing in .Net.
For those who asked what would you use instead of open MemoryStream, Tthe answer is to call ToByeArray on the stream, close the stream and return the array