6 Answers, 1 is accepted
First of all I would advise you to use the Close event of the Docking control to determine when a pane is closed instead of the PaneStateChange event.
When I pane is hidden it is not cleaned, but just hidden. If you need to clear the memory it uses you need to remove it from the Docking control and if you don't have other references the GC will do its job and clear it. The easies way to remove a pane from the Docking control is to use its RemoveFromParent method. For example you could handle the Close event and every time a pane is closed you could remove it to make sure it will clean the memory it occupies.
Of course there is a trade off - if you use the Save/load layout feature the content of the closed panes will not appear if you load a previously saved layout where these panes are not closed. This happens, because the content is removed from memory and the Docking control cannot load it.
Hope this information is helpful.
Best wishes,Miroslav Nedyalkov
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.
Eric Baker
I am attaching to the Close event and calling RemoveFromParent, but the DocumentPane is still referenced, according to WinDBG:
private static void OnDockingShellPaneClosed(object sender, StateChangeEventArgs e) { |
foreach (var pane in e.Panes) { |
pane.RemoveFromParent(); |
} |
GC.Collect(); |
} |
After calling !gcroot <Address> this is the output :
DOMAIN(05FA4AE8):HANDLE(Pinned):37012f4:Root: 081f6260(System.Object[])->
07240808(SLTrader.App.Shell)->
0728e8c0(Telerik.Windows.Controls.RadDocking)->
072c861c(Telerik.Windows.Controls.Docking.DocumentHost)->
073bb6d8(Telerik.Windows.Controls.RadSplitContainer)->
073ee3b0(Telerik.Windows.Controls.ProportionalStackPanel)->
073ee768(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
073ee7b4(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
073bb98c(Telerik.Windows.Controls.RadPaneGroup)->
073bba6c(Telerik.Windows.Controls.SelectionChanger`1[[System.Object, mscorlib]])->
078c3f0c(System.Collections.Generic.List`1[[System.Object, mscorlib]])->
078c3f24(System.Object[])->
073bc09c(Telerik.Windows.Controls.RadDocumentPane)
DOMAIN(05FA4AE8):HANDLE(Pinned):37012f8:Root: 081f4260(System.Object[])->
073bb98c(Telerik.Windows.Controls.RadPaneGroup)->
073bba6c(Telerik.Windows.Controls.SelectionChanger`1[[System.Object, mscorlib]])->
078c3f0c(System.Collections.Generic.List`1[[System.Object, mscorlib]])->
078c3f24(System.Object[])->
073bc09c(Telerik.Windows.Controls.RadDocumentPane)
Can you replicate?
I am using build Silverlight_4_2010_1_0515.
Regards,
James.
Thank you for reporting us this problem. I logged it in PITS and we will investigate what causes this problem. The PITS item id is 2207.
Regards,Miroslav Nedyalkov
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.
Could you please post the PITS link again? I think the one you provided was an internal URL.
James.
This pits issue is not public and is visible only under your account after login under Your Tracked Issues section.
Sincerely yours,
Hristo
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.