Memory Leak with Custom Bitmap in your CustomBitmapDemo sample

Aug 29, 2011 at 12:52 PM

First, sorry for my English.

I tried the application CustomBitmapDemo with one big image (+/- 50 Mb) loaded from disk (I have set the currect uri directly in the combobox).

Each time I switch the Second BitmapSource combobox from None to ColorKey, the memory continues to grow.

I wanted to use the colorkey to replace one color with transparency, but I have big memory problems.
Is there a workaround?

Coordinator
Oct 6, 2011 at 7:33 PM

I have confirmed this bug in WPF, and checked in a fix for our next version.  However, I know that doesn't do you any good; and unfortunately I don't know how to work around this issue in 4.0 bits.

Oct 13, 2011 at 5:51 PM

I have same problem.

Is there a workaround?

Coordinator
Oct 13, 2011 at 7:32 PM

I have just checked in a workaround.  I implemented IDisposable on CustomBitmap and ChainedBitmap, and use private reflection to break the problematic cycle.  I also added a GC button to the UI to help test.