Possible Memory leak

Feb 18, 2014 at 8:36 PM
I am working on a project which is using oxyplot to create an oscilloscope display. The display works fine and the performance is great, however when we bind our data collection to an OxyPlot LineSeries, the data objects are never deallocated, and after a few hours the application crashes. I used .Net Memory Profiler to confirm this.

The original implementation is using a ConcurrentQueue to provide the ItemsSource, and after adding new data and removing stale data, raised a NotifyPropertyChanged("DataQueue"). I also tried using an array as the ItemsSource and doing a DataQueue.ToArray and NotifyPropertyChanged("DataArray"). In both cases, the DataPoints are never garbage collected .
If, however, I use an ObservableCollection, and clear the data before I replace the collection, then the DataPoints are cleared properly.
The leak also disappears if I remove the binding in the LineSeries ItemsSource.

Am I simply using oxyplot in a way that is not intended (by using NotifyPropertyChanged to redraw a series, rather than using an observable collection)?

The following is a screenshot of the memory profiler references list of expired data, it appears as though the enumerators are not being discarded properly, or that there are event handlers keeping handlers from old data.

Image
Coordinator
Feb 27, 2014 at 7:42 PM
Yes, it looks like something is wrong here. I don't know if this is a problem within the OxyPlot implementation. Ideally, it should not be possible to get into this situation by 'wrong usage'...
Is it possible to create a small example that can reproduce the error and add it to the issues list?
Mar 6, 2014 at 7:57 PM
I saw the memory leak happened at example browser as well. in windows, if you keep clicking on different examples, the memory will keep growing.
Mar 7, 2014 at 3:13 PM
I have created an Issue for this at: https://oxyplot.codeplex.com/workitem/10151