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
close icon

SfChart (with Legend) memory leak

A child window containing only SfChart with a legend remains in memory after closing the window. The SfChart is disposed properly when it has no legend defined. For a sample test case, I've tried LineSeries and Doughnut Chart series separately and each with a simple legend definition as:

<chart:SfChart.Legend>

    <chart:ChartLegend/>

</chart:SfChart.Legend>

Thanks.


9 Replies 1 reply marked as answer

NM Nanthini Mahalingam Syncfusion Team December 20, 2022 04:22 AM UTC

Hi Miftah,


Thanks for your patience. We are validating the reported memory leak issue and will update the complete details in two business days (21.12.2022).


Regards,

Nanthini Mahalingam.



NM Nanthini Mahalingam Syncfusion Team December 21, 2022 04:52 AM UTC

Hi Miftah,

We have analyzed your query, and we can remove our chart control from the memory by calling chart's dispose method when we close the window as per the below code snippet. 

private void Window_Closed(object sender, EventArgs e)

{

              if (this.chart != null)

              {

                             chart.Dispose();

              }

}


If you have any questions, please let me know.


Regards,

Nanthini Mahalingam.


Attachment: SF179482_40b7239a.zip


MI Miftah replied to Nanthini Mahalingam December 21, 2022 07:53 AM UTC

Hi Nanthini,

As I explained in my problem description, I'm facing the issue when there is a legend definition for the chart. I had also confirmed that the chart is disposed properly when there is no legend definition.

Your sample attachment does not contain any legend defn.

Thanks.



NM Nanthini Mahalingam Syncfusion Team December 22, 2022 10:32 AM UTC

We apologize for the inconvenience, and we have modified our sample with legend. And we have attached memory snapshot in chart loaded time below.

Graphical user interface, text, application, Word

Description automatically generated

We have removed the chart from the memory by calling chart’s dispose method while closing the child window. We have attached after window closing memory snapshot below. 

Sample file is attached below.

If you have any queries, please let me know.


Attachment: SF179482_a08fb262.zip


MI Miftah December 23, 2022 08:41 AM UTC

Hi Nanthini,

Yes so far it's ok. Now I've attached the modified version of your sample to reproduce the problem. Here I'm starting the child window from the main window's notifyicon context menu. Without a legend, we don't see the child window in memory after closing it whereas a legend will keep the child window and I've shared its retention path. Please have a look.

Thanks.


Attachment: MemoryLeak_WPFChart_911490cd.zip


NM Nanthini Mahalingam Syncfusion Team December 27, 2022 12:50 PM UTC

Sorry for inconvenience,

We have reproduced the memory leak issue on our end, we are working on a solution for it. We will provide a solution for this issue on or before December 29th, 2022.



NM Nanthini Mahalingam Syncfusion Team December 29, 2022 05:17 AM UTC

We have analyzed the memory leak issue that is caused by the automation peer class. The WPF components hold some memory that needs to be released manually.

Please refer to the following document, which will be helpful in overcome this issue.

https://www.syncfusion.com/kb/3860/how-to-release-the-memory-held-by-automationpeer-in-wpf-components

Please contact us if you will need any further assistance.


Attachment: SF179482_7a4416d8.zip

Marked as answer

MI Miftah December 29, 2022 08:19 AM UTC

Hi Nanthini,

This solution has solved my problem.

Thanks a lot for your support.



PR Preethi Rajakandham Syncfusion Team December 30, 2022 06:44 AM UTC

Hi Miftah,

We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out.

Regards,

Preethi R


Loader.
Live Chat Icon For mobile
Up arrow icon