Dear Syncfusion team,
I’ve found a memory, or rather GREF leak, in the Xamarin.Forms Android implementation of the SfChart library.
In my project, I am populating a Xamarin.Forms ListView with
ViewCells that contain charts, keeping the list at a fixed size, but
always adding/removing elements, so new charts are constantly created,
while old ones should be GC’d/cleaned up. However, the platform eventually runs out of GREFs, printing "xxx outstanding GREFs. Performing a full GC!" but not cleaning up any, so that the app becomes stuck on doing full GCs.
This occurs when the YAxis property of a series in the chart is explicitly specified, i.e. the series does not use the chart’s normal SecondaryAxis.
I think the type of series does not matter, but for the record I have asserted the leak with both ColumnSeries and StepAreaSeries.
I think the chart need not even be visible (meaning that IsVisible can be false) nor the series contain any data points for the leak to occur.
If you have trouble reproducing this, please let me know and I’ll supply a full repro.
As it is, I think I’ve laid out the issue pretty well so I’ll just put a snippet in here to make sure we’ll be talking about the same kind of thing:
<chart:ColumnSeries ItemsSource="{Binding Path=SomeItemSource}"
x:Name="movementSeries"
Label="{Binding Path=SomeText}"
Color="DarkOrange">
<chart:ColumnSeries.YAxis>
<chart:NumericalAxis Minimum="0" Maximum="20"
OpposedPosition="True" />
</chart:ColumnSeries.YAxis>
</chart:ColumnSeries>
As you can see, I am defining the YAxis inline, causing the series to use something other than the chart’s SecondaryAxis. Probably it is something related to this seperate axis itself that doesn’t get completely cleaned up when/before the chart is GC’d.
Cheers and thanks for your efforts already!