My application consists of many data displays implemented as user controls that are opened and closed in tab pages on the main window. The user controls should be garbage collected when the tab is closed and the control is removed from the tab page. That works for all of the controls we currently use except for the user controls that contain an SfChart. I've been testing with
.NET Memory Profiler to analyze the problem. There are two instances where long-lived references to SfChart objects are keeping the charts alive after they should be garbage collected: the ChartAxisLabels and the ChartZoomPanBehavior.
I'm attaching a small project adapted from your sample that demonstrates the problem: in this app you can add and remove tabs to the main window. The app is tracking the user controls with weak references to check if they are still alive: when the simple user control is closed, it gets garbage collected, but when the chart tab is closed, it does not. Also included is a screen shot from the memory profile showing the object references.
Is there anything I can do to release these references so the chart will get garbage collected?
Attachment:
GCTest1_24e3bc0.zip