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

tabcontrol not freeing memory

8 Answers 161 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Alex Fan
Top achievements
Rank 1
Alex Fan asked on 18 Jun 2010, 07:59 AM
Hi,

I understand that SL4 has memory leak problem and the content of the tabitem is not released . But my problem is:

I have 2 tabs with ContentTemplate specified. One has empty content and another one has a very complex user control. Both 2 taps have Content property NOT set. Now i start to flip between 2 taps, and found that the memory usage increased by abt 20MB everytime when I selected the 2nd tab with complex user control. Eventually IE crashed.

Is this a different memory leak problem with RadTabControl? Many thanks.

Alex

8 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 23 Jun 2010, 01:14 PM
Hi Alex,

Thank you for your information. I researched the issue and I can conclude that the cause for it is the known memory leak with Silverlight's DataTemplate. Let me know if you have additional comments or questions regarding this topic.

On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverilght applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx

Sincerely yours,
Kiril Stanoev
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
Alex Fan
Top achievements
Rank 1
answered on 24 Jun 2010, 11:09 AM
Hi

Thanks a lot for the reply. As far as I remember in the original post of SL4 memory leak problem (the guy used weakreference.IsAlive to detect that), the problem only happens when using inline datatemplate. If it is datatemplate in resource, memory leak is not detected in the example.

In my case, I used datatemplate in resource and still had the problem. Could you clarify this for me? Many thanks.

Regards,
Alex
0
Kiril Stanoev
Telerik team
answered on 25 Jun 2010, 03:20 PM
Hello Alex,

Thank you for your feedback. What exactly does this "complex control" consists of?
The attachment is a sample project in which there are 2 DataTemplates. The simple DataTemplate contains just 1 TextBlock. The complex DataTemplate contains a RadGridView. To see that a TabControl is not present in the memory, toggle between the tab for some time, then click the Clear button (this button removes the TabControl from its parent panel)...then click the GC button which invokes the Garbage Collector and finally click Check Status to see whether the TabControl is alive or dead.
Probably a control in your complex DataTemplate stays in the memory?

Regards,
Kiril Stanoev
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
Alex Fan
Top achievements
Rank 1
answered on 27 Jun 2010, 07:59 AM
Hi Kiril

Thanks for your reply. I finally find out it is the memory leak from RadComboBox.

<telerik:RadTabControl x:Name="tabControl" Height="200">
                <telerik:RadTabItem Header="11"/>
                <telerik:RadTabItem Header="22">
                    <telerik:RadComboBox Loaded="RadComboBox_Loaded"/>
                </telerik:RadTabItem>
 </telerik:RadTabControl>

With above xmal, pleace catch RadComboBox_Loaded event and put sender which is radcombobox inside a weakreference. Then if you flip to the first tap and call GC.Collect a few times, the weakreference should not be alive because the radcombobox is reloaded every time, but for each combobox it is still alive.

In my real case, i used contenttemplateselector in radtabcontrol to select different datatemplate in application resource. Within the datatemplates, one is a very complex control (tileview control) with a lot of user controls in each tile. And because the RadComboBox in one tile is not released, the entire heavy tileview control is not released. And it is very serious for our application because the memory usage went up very quick as I told you in first post. If you can provide a quick workaround, I will deeply appreciate your help.

PS: I am using SL4 + .Net4.

Regards,
Alex
0
Alex Fan
Top achievements
Rank 1
answered on 28 Jun 2010, 05:18 AM
Hi

I also find that it's happening to some other controls:

RadDatePicker, and basically all ribbon controls are not able to be garbage collected.

Many thanks

Alex
0
Hristo
Telerik team
answered on 29 Jun 2010, 09:58 AM
Hello Alex Fan,

As Kiril said the problem is related to the bug in the Silverlight 4 framework. The problem is not related only to inline data templates (if you read all post you will see that there are other cases too).
In our case when you have Control in the template of another control then this control will leak. We have chrome controls in almost all of our control templates.
We are unable to do anything at the moment. I hope that Microsoft will release new Silverlight 4 build soon.

Best wishes,
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
0
Cuong
Top achievements
Rank 1
answered on 20 Apr 2015, 09:31 AM

Hi Kiril Stanoev,

I tried your demo. I see that:
When I click button Clear, then click button GC, the memory is not reduced.
It is same as my case when I close a tab.
(I used Windows Task Manager to check it)
Please help me.
Thanks.

0
Kiril Vandov
Telerik team
answered on 21 Apr 2015, 10:53 AM
Hello Cuong,

The sample application forks as expected on our side. However please note that even if you call GC.Collect() that does not mean that all the memory used will be release instantly. The GarbageCollector have a very sophisticated logic and it is releasing the unused object from the memory based on a lot criteria, it may take a few seconds to clear all the data.

If you are having similar problem to this one please open a new tread and describe your issue there. Doing so will help us better keep track on the responses and provide you with a concrete answer to your scenario. Also if you could provide us with a sample project reproducing the described behavior will help us analyze and track the problem.

Looking forward to hearing from you.

Kind regards,
Kiril Vandov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
TabControl
Asked by
Alex Fan
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Alex Fan
Top achievements
Rank 1
Hristo
Telerik team
Cuong
Top achievements
Rank 1
Kiril Vandov
Telerik team
Share this question
or