Issues with Memory leaks when adding and removing lines from live data

May 17, 2012 at 9:00 AM

I am getting a massive memory leak when I remove and replace line graphs from a ChartPlotter Object.  I have narrowed it down realised that when I am using the:


within my user control it is removing the line but not from the private member plotter.addedVisualElements is not decreasing.  I have looked at an example from a previous discussion:

with a extension to the plotter class that allows binding.  I have edited this so that it adds and removes line and this doesn't leak memory.  I have checked how this removes lines and it uses the same:


however, this causes plotter.addedVisualElements to decrease the same as plotter.Children.  I have stuggled to implement the example with the binding directly in my code.  Any ideas why my code is leaking whereas this example doesn't?

May 6, 2013 at 6:00 AM
Edited May 6, 2013 at 6:10 AM

chek this

this link may help you