Radpane is not garbage collected after closed.

1 Answer 157 Views
Docking
n/a
Top achievements
Rank 1
Iron
n/a asked on 13 May 2022, 02:06 AM

Hi,

I have a question for the problem related radpane resources.

In my project, radpane contains content which has sometimes more than 300mb of RAM for each instance(composed of telerik controls, GroupView etc.), so I really need to dispose radpane resources.

 

I followed instructions after searching some references, and it said that I should call radpane.RemoveFromParent(); for it to be garbage collected.

However, it is not working. The resources still remains same after even afeter calling the method.

The problem arises when radpane content is user control with only managed resources, which to be collected by GC.

 

Here is my code.

<RadDock>

   <RadPaneGroup>

          new <radpane> is created each time..

   </RadPaneGroup>

</RadDock>

 

When radpane is closed...

RadDock.CloseEvent += RaiseRadpaneCloseEvent();

RaiseRadpaneCloseEvent(object sender, eventargs e)

{

                // small codes to call radpane.....

 

                // here is radPane code.

                if (radPane != null)
                {
                    radPane.RemoveFromParent();

                    radPane.Content = null;
                    radPane.Header = null;
                    radPane.DataContext = null;
                    radPane.IsActive = false;
                    radPane.IsEnabled = false;
                    radPane = null;
                }

                // this works fine. When the content is UserControl

                // only some control is Idisposable, put only when unmanaged resources exist inside control .

                MethodInfo method = this.userControl.GetType().GetMethod("Dispose");
                if (method == null) return;

                method.Invoke(this.userControl, null);

}

 

Hope to get an answer quickly. Thanks.

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 17 May 2022, 11:04 AM

Hello Jiwon,

This is a known issue with the closing feature of the RadPane elements. You can find it logged in our feedback portal. To work this around, you can disable the automation peers.

public MainWindow()
{
    AutomationManager.AutomationMode = AutomationMode.Disabled;
    InitializeComponent();
}

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

n/a
Top achievements
Rank 1
Iron
commented on 18 May 2022, 01:08 AM

Unfortunately, It didn't solve the problem.

App is already automation mode disabled. Is there any other way around?

Martin Ivanov
Telerik team
commented on 20 May 2022, 10:51 AM

In this case, probably the issue is rooted somewhere else. In order to test this I've prepared a small project based on your code, but I couldn't reproduce any memory leaks. Can you check the project and let me know if I am missing anything?
Tags
Docking
Asked by
n/a
Top achievements
Rank 1
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or