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

RadDocumentPane Closed? or Hidden?

6 Answers 292 Views
Docking
This is a migrated thread and some comments may be shown as answers.
ebaker
Top achievements
Rank 1
ebaker asked on 18 Feb 2010, 09:09 PM
I'm using a RadDocking.PaneStateChange event handler to receive notification when one of the RadDocumentPanes is hidden. The RadDocumentPanes are created in code with the CanUserClose option set to True.

When the user clicks the cross control to close the pane, the PaneStateChange event handler is fired and the pane's IsHidden field is set to True. But... if there are no other references in my code to this RadDocumentPane object that has been hidden, or to any of its content, are the pane object and its content released and Garbage Collected? Or are they orphaned and just eating up memory? I guess the difference between "hiding" and pane and "closing" it are not clear to me.

I'm concerned about memory usage as I have several panes that can be opened, closed, and re-opened.

Thanks,
Eric Baker

6 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 19 Feb 2010, 08:41 AM
Hello Eric,

 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.
0
ebaker
Top achievements
Rank 1
answered on 19 Feb 2010, 03:32 PM
Thank you, Miroslav. I completely missed the Close event of the RadDocking control. That was exactly what I needed.

Eric Baker

0
James
Top achievements
Rank 1
answered on 17 May 2010, 07:49 AM
Hello,

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.
0
Miroslav Nedyalkov
Telerik team
answered on 19 May 2010, 01:05 PM
Hello 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.
0
James
Top achievements
Rank 1
answered on 24 May 2010, 03:05 AM
Thanks,

Could you please post the PITS link again? I think the one you provided was an internal URL.

James.
0
Hristo
Telerik team
answered on 27 May 2010, 01:49 PM
Hello 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.
Tags
Docking
Asked by
ebaker
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
ebaker
Top achievements
Rank 1
James
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or