I draw chart with DynamicDataDisplay.ChartPlotter and each time I redraw the chart memory increase. So when I have redraw 200 times my chart memory of my app increase to 200mo in memory.
I tried to GC.Collect() manually but nothing change.
private ChartPlotter _courbeChartPlotter;
public ChartPlotter CourbeChartPlotter
{
get { return _courbeChartPlotter; }
set
{
_courbeChartPlotter = value;
RaisePropertyChanged();
}
}
private static ListPointD3Cs _listeX = new ListPointD3Cs { new Point(0, 0) };
private static EnumerableDataSource<Point> dsX = new EnumerableDataSource<Point>(_listeX);
private int nbPoint = 0;
public void TakeMeasureTest()
{
nbPoint++;
_listeX.Add(new Point(nbPoint, GetRandomNumber(-1, 1)));
InitDotsCourbe(out dsX);
TraceCourbe(dsX);
}
public void InitDotsCourbe(out EnumerableDataSource<Point> dsX)
{
dsX = new EnumerableDataSource<Point>(_listeX);
dsX.SetXMapping(x => x.X);
dsX.SetYMapping(y => y.Y);
}
public ChartPlotter TraceCourbe(EnumerableDataSource<Point> dsX)
{
CourbeChartPlotter = new ChartPlotter();
ViewPortAxesRangeRestriction restr = new ViewPortAxesRangeRestriction
{
XRange = new DisplayRange(0, nbPoint + 1),
YRange = new DisplayRange(-2, 2)
};
CourbeChartPlotter.Viewport.Restrictions.Add(restr);
CourbeChartPlotter.AddLineGraph(dsX, Colors.Red, 2, "X");
return CourbeChartPlotter;
}
I want memory not increase each time I redraw the chart or at least when I GC.Collect()
after all Measure retrieve a normal memory usage.