CompositionTarget.Rendering leak?

Apr 19, 2012 at 3:08 PM


I think I've stumbled upon a memory leak when dynamically generating plots. Imagine something like this:

<ItemsControl ItemsSource="{Binding}">
            <StackPanel Orientation="Vertical" />
            <oxy:Plot Model="{Binding}" Height="300"/>

Even though the context changes, "old" plots remain hooked and, after profiling, I'm pretty sure the CompositionTarget.Rendering event is the culprit.

I eagerly await your comments on this.

Thank you

Apr 19, 2012 at 8:29 PM

thanks for the notice, I have planned to do some memory profiling, will try to get it done soon.

I have implemented a weak event manager for the rendering event in the helix toolkit, this should be possible to use.

Apr 20, 2012 at 1:14 PM

I saw that you've had a similar problem on the helix project, however the weak event manager you've used over there is not available in SL.

Another problem is that in SL the CompositionTarget class is static, not abstract, as in WPF, so it can't be used as an argument to most weak event listeners available out there that use generics when subscribing.