[Mono-dev] Memory Leak (Bitmap)Image.FromStream(memory_stream)

Robert Jordan robertj at gmx.net
Fri Mar 24 19:17:53 UTC 2017


On 23.03.2017 21:51, rgclickit wrote:
> I believe I discovered a memory leak when creating Bitmaps from the
> Image.FromStream call. The basic code to reproduce the problem is:
>
> using (System.IO.MemoryStream ms = new System.IO.MemoryStream(_sourceArray))
> {
>      using (Bitmap srcBitmap = (Bitmap)Image.FromStream(ms)) {
>      }
> }
>

I cannot reproduce this. The odds are that you're not computing
the memory usage correctly.

See 
http://www.mono-project.com/docs/advanced/performance-tips/#understanding-memory-usage

Robert




More information about the Mono-devel-list mailing list