Hi,
I have implemented some custom layers (derived from DynamicLayer and TiledLayer). When I use many of these layers, including some existing layers in the runtime, I experience a build-up of memory, which is then garbage collected. Sometimes the GC doesn't hit soon enough, and I get out of memory exception. I've done some research, and pinpointed the build-up to BitmapImage. If I use my custom layers inside of AcceleratedDisplayLayer, implementing the appropriate interfaces, I don't get this issue. I have tried freezing the image, but then I get an InvalidOperationException when the base class is doing cleanup of resources. It can't set the image.Source = null because the image IsFrozen.
Are there any plans to change this, or ways that I can still use frozen images? I did a sample a while ago where I converted a GDI bitmap into a bitmapsource using Interop helpers, and those I could freeze for some reason. But I found another memory leak to that, so no cigar.
Any suggestions?