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

TrackBall Memory Leak

1 Answer 109 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Christian M
Top achievements
Rank 1
Christian M asked on 27 Jun 2012, 09:00 AM
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

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 02 Jul 2012, 07:57 AM
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 >>

Tags
ChartView
Asked by
Christian M
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or