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

RadTabControl Memory Leaks

1 Answer 236 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Joe Schick
Top achievements
Rank 1
Joe Schick asked on 26 Apr 2010, 09:50 PM
Hi,

In the process of implementing a prism region adapter for the RadTabControl I think I've discovered some memory leaks.

My tab control uses the DisplayMemberPath property and it's ItemsSource is set to an ObservableCollection in my region adapter. The region adapter add/removes views to/from the ObservableCollection causing the tab control to create/remove RadTabItems.

Memory Leaks
1. When the tab control removes a RadTabItem it doesn't set its Content property to null.
2. When DisplayMemberPath is used the RadTabItem's DataContext is set to the view. When a RadTabItem is removed the DataContext is not set to null.
3. Tab control uses a TabWrapPanel which continues to hold a reference to a RadTabItem after it is removed.

So far I've been unable to work around 2 and 3. Any suggestions?

Thanks,

Joe

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 30 Apr 2010, 09:31 AM
Hello Joe,

Thank you for your feedback.

1) This is correct. Internally, when a TabItem is removed, we do not set its content explicitly to null. This scenario should be handled internally by the ItemsControl, the TabControl should generally modify the Content of its items. If the content is long-lived the TabItem should still be garbage collected if there are no other items.

2) TabControl has a new property called PropagateItemDataContextToContent that indicates whether the data context of the TabItem should be assigned as DataContext of the content area when the selection changes. The default value of the property is true. Try setting it to false and let us know if you are still experiencing issues.

3) You are correct that TabWrapPanel holds a list of the TabItems, but this list gets cleared on each measure / arrange. The measure / arrange pass after the items have been cleared should release them from the panel as well.

There is a memory leak with the templates in SL4, I am not sure if this applied in your case but it may be good to know:

http://forums.silverlight.net/forums/t/171739.aspx

We well be happy to investigate the memory leak in your particular case if you can send us a project that reproduces the problem.

Sincerely yours,
Kiril Stanoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TabControl
Asked by
Joe Schick
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or