tabcontrol not freeing memory

9 posts, 0 answers
  1. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 18 Jun 2010 Link to this post

    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
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 23 Jun 2010 Link to this post

    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
  3. DevCraft banner
  4. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 24 Jun 2010 Link to this post

    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
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 25 Jun 2010 Link to this post

    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
  6. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 27 Jun 2010 Link to this post

    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
  7. Alex Fan
    Alex Fan avatar
    39 posts
    Member since:
    Jul 2009

    Posted 28 Jun 2010 Link to this post

    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
  8. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 29 Jun 2010 Link to this post

    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
  9. Cuong
    Cuong avatar
    8 posts
    Member since:
    Jan 2015

    Posted 20 Apr 2015 in reply to Kiril Stanoev Link to this post

    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.

  10. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 21 Apr 2015 Link to this post

    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.

     
Back to Top
DevCraft banner