This is a migrated thread and some comments may be shown as answers.

xaml-sdk SeriesProvider sample - memory leak

2 Answers 11 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
yoochul
Top achievements
Rank 1
yoochul asked on 31 Oct 2018, 03:12 AM

Hi,

https://github.com/telerik/xaml-sdk/tree/master/ChartView/WPF/SeriesProvider

 

# SeriesProdvider project

1. Add new item : window1.xaml (include one button)

 2. app.xaml  StartupUri   set  window1.xaml 

 3.  window1.xaml  button client event

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MainWindow w = new MainWindow();
            w.ShowDialog();
        }

4. Run button click - PopupWindow Open & Close (Loop.. Loop.. Loop)

5. Memeory Leak check

 

I found a solution

        public MainWindow()
        {
            InitializeComponent();
            this.Unloaded += MainWindow_Unloaded;               
        }
        private void MainWindow_Unloaded(object sender, RoutedEventArgs e)
        {
            chart.SeriesProvider.Source = null; 
        }

I want to more best solution, for plan MVVM project

 

2 Answers, 1 is accepted

Sort by
0
yoochul
Top achievements
Rank 1
answered on 31 Oct 2018, 04:51 AM

Sorry..

It is my mistake.

MVVM Best solution is data clear.

Ex)

        private void MainWindow_Unloaded(object sender, RoutedEventArgs e)
        {
            if (this.DataContext is MyViewModel vModel)
            {
                vModel.Data.Clear();
            }
        }

0
Martin Ivanov
Telerik team
answered on 02 Nov 2018, 12:39 PM
Hello Yoochul,

Thank you for reporting this. This is a known memory issue with the control. You can find it logged in our feedback portal. To resolve this you will need to clear the ItemsSource of all series in the chart. This happens under the hood on several occasions, like clearing the data from the model or setting the source of the SeriesProvider to null. 

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
yoochul
Top achievements
Rank 1
Answers by
yoochul
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or