We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfCharts are not getting garbage collected when closed

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

1 Reply

MK Muneesh Kumar G Syncfusion Team February 12, 2019 12:13 PM UTC

Hi Doug, 
 
Greetings, we were able to reproduce the issue “Memory leak in WPF chart” and we confirm this as a bug and logged a defect report already. You can keep track of the bug from the feedback portal below.  
   
   
The fix for the reported issue will be included in our nuget release which will be available on February 26th, 2019.  
  
If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.  
    
Thanks,    
Muneesh Kumar G.   


Loader.
Live Chat Icon For mobile
Up arrow icon