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

RadPane not garbage collected when closed

1 Answer 440 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 01 Jun 2012, 05:50 PM
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

1 Answer, 1 is accepted

Sort by
0
Adam Marshall
Top achievements
Rank 1
answered on 04 Jun 2012, 11:15 PM
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
Tags
Docking
Asked by
Richard
Top achievements
Rank 1
Answers by
Adam Marshall
Top achievements
Rank 1
Share this question
or