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

Memory leak while using aggregation?

14 Answers 109 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Petr
Top achievements
Rank 1
Petr asked on 13 Sep 2011, 07:36 PM
Hi,

We use RadChart (Q3 2010) that is being repeatedly bound to a list of data. We are seeing a memory leak in cases where there is a larger amount of data and the automatic aggregation of RadChart takes place. Is that a known issue?

Thank you.

Petr

14 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 16 Sep 2011, 12:52 PM
Hello Petr,

During the past iterations we were able to spot some memory issues and fix them,
including the one caused by our sampling functionality. I have attached a small test application that uses the latest binaries and doesn't reproduce this memory issue. You can get our latest binaries and test in your environment.

Hope this helps!

Greetings,
Yavor Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Iñigo
Top achievements
Rank 1
answered on 27 Sep 2011, 04:53 PM
Hi, I have a similar problem, I have a bar chart with several data series and groups, I add DataPoints one by one to the series. Whenever I update the data, the memory usage increases about 10MB. Do you think you could make an example application like this one but using dataseries and adding datapoints instead of just setting an itemsource?
Thanks and kind regards
0
Iñigo
Top achievements
Rank 1
answered on 28 Sep 2011, 11:26 AM
Hi again, I have removed the seriesmappings and now I am just binding to my chart an observablecollection of observablecollections. The first time I load data into the inner observablecollections, the chart gets bound with the data (it looks odd since I have not defined any seriesmapping, but it's ok for testing), but when I modify the content of the inner observablecollections the chart does not react (it does not change the data, it does not fire the bounding event...). It only changes when I call the "rebind" method of the chart (then, memory usage increases)... ¿any idea why it does not react to the changes in the data without calling the "rebind" method?
Thanks and regards
0
Yavor
Telerik team
answered on 30 Sep 2011, 09:13 AM
Hi Iñigo,

About your first question, yes, you can change from using series mappings and itemsSource to unbound mode. By doing this you won't be able to use some of the advanced RadChart functionalities like sampling, grouping & aggregation, filtering and sorting. This can spare some objects related to the data layer, but on the UI layer everything will remain the same.

We have found a major unmanaged leak in SL4 and we have actually reported this bug to Microsoft 3-4 months ago but still there is no fix. You will see both managed and unmanaged memory leak in SL4. Unfortunately currently our hands are tied with respect to this problem and at this point we can only hope that eventually there will be SL4 release that contains these important fixes.

When you have removed the SeriesMappigns RadChart will create a chart series for every numeric field in the data source by mapping the numeric value to the DataPointMember.YValue field for each respective series. You can find more information in this topic in our help system. This automatic behavior doesn't recognize nested collections, so in your scenario it is recommended to add your series mappings manually like described in this topic in our help system.

Hope this information helps!

All the best,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Gregory
Top achievements
Rank 1
answered on 27 Oct 2011, 05:08 PM
Can anyone suggest any workaround at all for this issue? It is holding up the release of one of our products.
0
Yavor
Telerik team
answered on 01 Nov 2011, 03:15 PM
Hi Gregory,

We have tested RadChart for Silverlight against the latest drop of SL5 and this unmanaged memory leak is no longer observed. As currently there are no known issues, you can safely update to the latest drop of SL5 and test your scenario.

Regards,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Shashikant
Top achievements
Rank 1
answered on 01 Dec 2011, 09:04 AM
Hi Yavor ,

We are facing memory leak when sort descriptor is added to RadChart.

I downloaded this sample code posted by you and changed it slightly to show collection of Share prices on timer tick.
I have used the same solution files, binaries which you shared with the code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Collections.ObjectModel;
 
namespace SilverlightApplication1
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
 
            DispatcherTimer timer = new DispatcherTimer();
            timer.Tick += timer_Tick;
            timer.Interval = TimeSpan.FromMilliseconds(500);
            CreateData();
            this.chart1.ItemsSource = data;
            timer.Start();
        }
 
        ObservableCollection<SharePrice> data = new ObservableCollection<SharePrice>();
        Random r = new Random();
 
        private void CreateData()
        {
            for (int i = 0; i < 250; i++)
            {
                data.Add(new SharePrice(DateTime.Now, r.Next(0, 100)));
            }
        }
 
        private void timer_Tick(object sender, EventArgs e)
        {
            data.RemoveAt(0);
            data.Add(new SharePrice(DateTime.Now, r.Next(0, 100)));
        }
    }
 
    public class SharePrice
    {
        public DateTime PriceOn { get; set; }
        public double  Price { get; set; }
 
        public SharePrice(DateTime dt, Double price)
        {
            this.PriceOn = dt;
            this.Price = price;
        }
    }
 
}

And then added sort descriptor in RadChart tag in XAML file that and now one can see memory leak.

<UserControl x:Class="SilverlightApplication1.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
 
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadChart Name="chart1">
            <telerik:RadChart.SortDescriptors>
                <telerik:ChartSortDescriptor Member="PriceOn" SortDirection="Ascending"/>
            </telerik:RadChart.SortDescriptors>
            <telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping x:Name="SeriesMapping1" >
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:LineSeriesDefinition />
                    </telerik:SeriesMapping.SeriesDefinition>
                    <telerik:ItemMapping FieldName="PriceOn" DataPointMember="XValue"/>
                    <telerik:ItemMapping FieldName="Price" DataPointMember="YValue"/>
                </telerik:SeriesMapping>
            </telerik:RadChart.SeriesMappings>
            <telerik:RadChart.DefaultView>
                <telerik:ChartDefaultView>
                    <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea EnableAnimations="False" />
                    </telerik:ChartDefaultView.ChartArea>
                </telerik:ChartDefaultView>
            </telerik:RadChart.DefaultView>
        </telerik:RadChart>
    </Grid>
</UserControl>


We are pretty much sure about the memory leak as we have profiled this application with a professional profiling tool.
If you remove only the sort descriptor part, the memory leak will be eliminated.

In our project, we will need sort descriptor and hence need to leave with this memory leak.
Please provide us with a solution on this memory leak.

Thanks,
Shashikant
0
Ves
Telerik team
answered on 05 Dec 2011, 05:22 PM
Hi Shashikant,

I can confirm that we were able to reproduce the problem and our developers are already working on it. I will write back when we have any news.

Best regards,
Ves
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ves
Telerik team
answered on 07 Dec 2011, 04:38 PM
Hi Shashikant,

Our developers were able to provide a partial fix which will be included in the next internal build, expected on Monday. The fix is partial, because it does not cover the case where the sort descriptors are added to RadChart's SortDescriptors collection. However, there will be no memory leak if SeriesMapping.SortDescriptors property is used. So, once it is out, please download the next LIB and move the sort descriptors to the series mapping.

Best regards,
Ves
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Shashikant
Top achievements
Rank 1
answered on 27 Dec 2011, 07:40 AM
Thanks Ves,

Can you please give me the link where this fix/update is available for download?

Thanks,
Shashikant
0
Giuseppe
Telerik team
answered on 28 Dec 2011, 09:14 AM
Hi Shashikant,

The weekly internal build is available in the Download section of your Telerik client account.


Regards,
Giuseppe
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Srinath
Top achievements
Rank 1
answered on 20 Jan 2012, 09:55 AM
Hello Telerik Team,

We downloaded the latest weekly internal build from our client account. We observed that RadMaskedTextBox does not exist in the binaries and our source code makes extensive use of the same.We are in process of verifying the fix for memory leak in RadChart using SortDescriptors.Can you please look into this?

Thanks
Srinath Dayala
0
Tina Stancheva
Telerik team
answered on 24 Jan 2012, 11:03 AM
Hi Srinath,

The RadMaskedTextBox control is removed from the toolbox as we want to encourage our customers to take advantage of the new MaskedInput suite of controls instead. However, other than that the control is still part of the RadControls for Silverlight and its class definitions are in the Telerik.Windows.Controls.Input assembly so I am not sure what you mean by "we observed that RadMaskedTextBox does not exist in the binaries". Can you please elaborate on that and also tell us which version of our libraries you have downloaded?

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Srinath
Top achievements
Rank 1
answered on 24 Jan 2012, 12:50 PM
Thanks Tina Stancheva for your reply.
We now used the Telerik.Windows.Controls.Input dll and the code is compiling.Thanks for the information.
Tags
Chart
Asked by
Petr
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Iñigo
Top achievements
Rank 1
Gregory
Top achievements
Rank 1
Shashikant
Top achievements
Rank 1
Ves
Telerik team
Giuseppe
Telerik team
Srinath
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or