RadTabControl Memory Leaks

2 posts, 0 answers
  1. Joe Schick
    Joe Schick avatar
    14 posts
    Member since:
    Oct 2009

    Posted 26 Apr 2010 Link to this post


    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?


  2. Kiril Stanoev
    Kiril Stanoev avatar
    1512 posts

    Posted 30 Apr 2010 Link to this post

    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:


    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.
Back to Top