TrackBall Memory Leak

2 posts, 0 answers
  1. Christian M
    Christian M avatar
    3 posts
    Member since:
    Oct 2011

    Posted 27 Jun 2012 Link to this post

    I have an application with potential thousands of views (as radpanes with a single usercontrol) and therefore need to make sure they can be cleaned-up, when they are not needed anymore.
    I had some trouble with the radpanes, but eventually got it working for most of my views.

    However I have run into problems with views containing charts.
    What I have come up with is that the trackball keeps a reference to the usercontrol containing the chart. So while I manage to get rid of the radpane, the usercontrol is beeing kept in memory.

    With a memory-profiler I have found out that the offending class is Telerik.Windows.Controls.ChartView.DataPointInfo, which apparantly has some valueChangedHandlers that are not cleaned up.

    I have given up trying to clean these up myself, so I really hope you have a fix for this in the works.

    Is this something you are working on?

    Best regards
    Christian M. Madsen
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 02 Jul 2012 Link to this post

    Hi Christian,

    The problem you are facing is caused by the default bindings that the WPF creates when binding a text field. If you have put a trackBallInfo template that contains a TextBlock like this:

    <telerikChart:ScatterLineSeries>
        <telerikChart:ScatterLineSeries.TrackBallInfoTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=DisplayHeader}" Foreground="Blue" FontWeight="Bold"/>
                    <TextBlock Text="{Binding Path=DisplayContent}" Foreground="Blue" Margin="4,0,0,0"/>
                </StackPanel>
            </DataTemplate>
        </telerikChart:ScatterLineSeries.TrackBallInfoTemplate>
    </telerikChart:ScatterLineSeries>

    the framework creates a two way binding to the text field of the textblock. This will cause the underlying object to be held by the textblock and thus creates the memory leak. You can easily fix it by explicitly specifing that this binding is OneWay or OneTime.Greetings,
    Yavor
    the Telerik team

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

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top