RadPane not garbage collected when closed

2 posts, 0 answers
  1. Richard
    Richard avatar
    2 posts
    Member since:
    Dec 2011

    Posted 01 Jun 2012 Link to this post

    I have a project where I programmatically create and add RadPanes to a RadDocking control. When the user closes the RadPane it doesn't get garbage collected.

    I'm using Redgate's ANTS Memory Profiler to confirm this, and I can see RadDocking control maintains an array of EffectiveValueEntrys which stop the GC collecting the RadPane.

    I've seen this thread : http://www.telerik.com/community/forums/wpf/docking/why-not-dispose-of-radpanes-memory-leak-issue.aspx  and have implemented the solution (RemoveFromParent and e.Handled = true), but this still doesn't solve the problem (it does solve another issue we were having so I still need that code in there).

    The RadPane is created

    var pane = new RadPane();
     
    var paneGroup = new RadPaneGroup();
    paneGroup.Items.Add(pane);
     
    var splitContainer = new RadSplitContainer();
    splitContainer.Items.Add(paneGroup);
     
    this.dockingControl.Items.Add(splitContainer);
    pane.MakeFloatingDockable();

    I've attached a screenshot of the ANTS profiler Retention Graph for the RadPane. I'm unable to attach a zip file containing a sample project which shows the problem (although you'll need to be running a memory profiler to see the bug), as I can only upload (gif, jpg, jpeg or png) but I have it ready to upload if there is an alternative upload facility.

    Could you please advise me on how to fix this problem. Is this a known bug, or am I simply creating/destroying the pane incorrectly?

    Kind regards,

    Rich Keenan
  2. Adam Marshall
    Adam Marshall avatar
    46 posts
    Member since:
    Nov 2009

    Posted 04 Jun 2012 Link to this post

    Hi Rich,

    I have been having the same sort of issues and have just resolved mine today.

    I am using MVVM with the telerik PaneGroupExtensions class.

    I found that when I used my ViewModels to close the pane the Panes were not being GC'd. However, when I used the Close button in a Floating Pane they were GC'd.

    I found the Pane was holding references to the ViewModels in a number of properties. I had to clear these references before calling pane.RemoveFromParent and then the Pane and ViewModel were GC'd correctly

    pane.Content = null;
    pane.Header = null;
    pane.DataContext = null;
    pane.RemoveFromParent();

    Hope this helps,

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