Memory leak

7 posts, 0 answers
  1. Andrew
    Andrew avatar
    20 posts
    Member since:
    Mar 2010

    Posted 17 Dec 2010 Link to this post

    Hello,

    I think I found a memory leak.

    The source code for my program - XAML:

    <Grid x:Name="LayoutRoot" Background="White">
       <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="*" />
       </Grid.ColumnDefinitions>
       <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="*" />
          <RowDefinition Height="*" />
       </Grid.RowDefinitions>
     
       <telerikChart:RadChart Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" x:Name="radChart">
       <telerikChart:RadChart.DefaultView>
          <telerikCharting:ChartDefaultView>
              <telerikCharting:ChartDefaultView.ChartArea>
                  <telerikCharting:ChartArea LegendName="chartLegend">
                      <telerikCharting:ChartArea.DataSeries>
                           <!-- Doughnut Chart -->
                           <telerikCharting:DataSeries>
                                <telerikCharting:DataSeries.Definition>
                                     <telerikCharting:DoughnutSeriesDefinition ItemLabelFormat="p">
                                     </telerikCharting:DoughnutSeriesDefinition>
                                 </telerikCharting:DataSeries.Definition>
                                 <telerikCharting:DataPoint YValue="0.215208267" LegendLabel="Toyota"/>
                                 <telerikCharting:DataPoint YValue="0.192960612" LegendLabel="General Motors"/>
                                 <telerikCharting:DataPoint YValue="0.151830229" LegendLabel="Volkswagen"/>
                                 <telerikCharting:DataPoint YValue="0.125964366" LegendLabel="Ford"/>
                                 </telerikCharting:DataSeries>
                             </telerikCharting:ChartArea.DataSeries>
                         </telerikCharting:ChartArea>
                     </telerikCharting:ChartDefaultView.ChartArea>
                 </telerikCharting:ChartDefaultView>
             </telerikChart:RadChart.DefaultView>
         </telerikChart:RadChart>
     
         <telerik:RadRichTextBox Grid.Row="0" Grid.Column="1" Margin="10" x:Name="rRichTextBox1" IsReadOnly="True" />
         <telerik:RadRichTextBox Grid.Row="1" Grid.Column="1" Margin="10" x:Name="rRichTextBox2" IsReadOnly="True" />
         <telerik:RadRichTextBox Grid.Row="2" Grid.Column="1" Margin="10" x:Name="rRichTextBox3" IsReadOnly="True" />
    </Grid>

    And the code behind:
    public MainPage()
    {
        InitializeComponent();
     
        radChart.DefaultView.ChartArea.ItemClick += ChartArea_ItemClick;
    }
     
    void ChartArea_ItemClick(object sender, Telerik.Windows.Controls.Charting.ChartItemClickEventArgs e)
    {
        HtmlFormatProvider html = new HtmlFormatProvider();
     
        rRichTextBox1.Document = html.Import(AddText(e.DataPoint.LegendLabel, e.DataPoint.YValue.ToString()));
        rRichTextBox2.Document = html.Import(AddText(e.DataPoint.LegendLabel, e.DataPoint.YValue.ToString()));
        rRichTextBox3.Document = html.Import(AddText(e.DataPoint.LegendLabel, e.DataPoint.YValue.ToString()));
    }
     
    private string AddText(string item, string value)
    {
        StringBuilder builder = new StringBuilder();
        builder.Append("<table>");
        builder.Append("<tr>");
        builder.Append("<td>");
        builder.Append("<b>Item clicked:</b>");
        builder.Append("</td>");
        builder.Append("<td>");
        builder.Append("<b>Value:</b>");
        builder.Append("</td>");
        builder.Append("</tr>");
        builder.Append("<tr>");
        builder.Append("<td>");
        builder.Append(item);
        builder.Append("</td>");
        builder.Append("<td>");
        builder.Append(value);
        builder.Append("</td>");
        builder.Append("</tr>");
        builder.Append("</table>");
        builder.Append("<p>And some extra text: RadChart for Silverlight is the exact tool to transform various business scenarios into interactive, rich, animated charts that enable the end users to analyze complex data. Telerik Silverlight Chart is a 100% lookless control providing full support for Expression Blend.  All 2D series, charts and axis elements can be dropped independently in Blend and styled individually. Furthermore the control offers several pre-defined skins, which will help you to deliver a consistent look and feel in your application.application best.</p>");
     
        return builder.ToString();
    }

    Run this program and click chart control few times (memory usage will increase).

    In this simple program memory usage stopped increasing after a while, but in my real application (where data is loaded from a database) – it never stops.

  2. Boby
    Admin
    Boby avatar
    595 posts

    Posted 22 Dec 2010 Link to this post

    Hello Andrew,
    We did reproduce the issue, and it will be immediately fixed and included in the Q3 SP1, which is coming in a week or so.

    Please, excuse us for the inconvenience. We have added points to your account for this bug report. Don't hesitate to contact us if you have other questions.

    Regards,
    Boby
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Andrew
    Andrew avatar
    20 posts
    Member since:
    Mar 2010

    Posted 18 Jan 2011 Link to this post

    Hello again.

    Now I have service pack and the problem is still there. 
    Similar problem is when I change RichTextBox to Chart and in ChartArea_ItemClick event I modify ItemsSource:
    radChart.ItemsSource = new int[] { 12, 56, 23, 89, 12, 56, 34, 78, 32, 56 };
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 21 Jan 2011 Link to this post

    Hello Andrew,

    We verified that the memory leak in RadRichTextBox has been fixed in Q3.SP1. Our only concern is the SpellChecker, which creates a Dictionary that holds references to some strings. We will investigate the issues further, but since you have managed to reproduce the issue with a chart in place of the rich text boxes, I assume the problem does not lie there. Setting the IsSpellCheckingEnabled property to false may be a temporary workaround, especially if you are using the rich text boxes in ReadOnly mode.

    As for the chart -- indeed, there is a small increase in memory usage in the scenario you have described. Our developers have already fixed some issues with memory usage in RadChart and they will continue to investigate and search for additional reasons for this behavior.

    Best regards,
    Ves
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Matthew
    Matthew avatar
    3 posts
    Member since:
    Sep 2010

    Posted 04 Feb 2011 Link to this post

    I am running into memory leaks when using the Dictionary object as well.  Do you have any idea when a fix for this issue will be released?  The memory loss is dramatic and crashes my application before very long.
  7. jdgoulden
    jdgoulden avatar
    20 posts
    Member since:
    Nov 2006

    Posted 08 Feb 2011 Link to this post

    I am experiencing enormous memory leaks in the RadChart control while dynamically updating the data series. Is anyone else experiencing these problems and how are you mitigating the issues. So far I've gotten a commitment that they are "working on it and will address it in an upcoming release", not really the answer I can give my customers.
  8. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 09 Feb 2011 Link to this post

    Hi,

    Matthew: For the time being, please hide the pointmarks, tooltips and labels.

    jdgoulden: As mentioned in our reply to your support ticket, please use the same workaround for the moment.

    We will get back to you as soon we have any news.

    Best regards,
    Ves
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top
DevCraft banner