CompositionTarget.Rendering leak?

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

anomistu wrote at 2012-04-19 16:08:


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

objo wrote at 2012-04-19 21:29:

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.

anomistu wrote at 2012-04-20 14:14:

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.