Potential Memory Leak?

5 posts, 0 answers
  1. Preston
    Preston avatar
    19 posts
    Member since:
    Apr 2009

    Posted 01 Oct 2012 Link to this post

    Telerik Team,

    I have reviewed several posts in regards to inline Templates, SL4 bugs, etc.  However, I believe my circumstance is a bit different.  I am currently using SL 5.  Perhaps you could help shed some light on the problem.

    I have a Telerik ItemsControl which retrieves its DataTemplates via the Telerik DataTemplateSelector.  I have a simple DataTemplate I created that is loaded into the ItemsControl only once.  Keep in mind, I am following the MVVM pattern.  Therefore, the View that contains the ItemsControl is bound to a ViewModel that exposes the Collection of items bound to the ItemsControl. Fairly simple. 

    Here is my problem; when I remove the View from my Shell and the Visual Tree the destructor is never called on my ViewModel when that simple DataTemplate contains a Telerik Editor (perhaps other controls as well, however, I have not tested those scenarios). When I remove the Telerik Editor and replace it with a native Silverlight Control, everything works as expected. 
    Build: 2012.2.607.1050

    Any ideas?

    Thanks in advance

  2. Petya
    Petya avatar
    975 posts

    Posted 04 Oct 2012 Link to this post

    Hi Preston,

    Thank you for contacting us with this issue!

    Prior the release of the Q2 SP2 version of RadControls for Silverlight we made some changes in regard to memory leaks in similar scenarios. Can you please update to that version and see if the issue persists? If so, it would be helpful if you can send us a sample to investigate, so we don't miss something when trying to reproduce the issue.

    Thank you in advance! I'm waiting for your reply.
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Preston
    Preston avatar
    19 posts
    Member since:
    Apr 2009

    Posted 09 Oct 2012 Link to this post


    Thank you for your response.  After further analysis, I have discovered that the problem can be duplicated with far less complexity than what was described in my previous post. 

    Attached you will find a zip file containing a simple application that contains a UserControl (View) containing a single RadMaskedTextInput, another UserControl containing a single native TextBox, and a MainPage with a ContentControl to host either UserControl.  The MainPage Contains 4 buttons that allow you to add and remove each respective UserControl to and from the ContentControl as well as calling GC.Collect() where appropriate.  For good measure, I also provided a simple binding to a ViewModel containing a single string property. 

    What is expected:

    I would expect the destructor to be invoked each time either UserControl is removed from the ContentControl and GC.Collect() is executed. 

    What is exhibited:

    The destructor is only invoked when the UserControl containing the native TextBox is removed from the ContentControl.  When the UserControl containing the MaskedTextInput is removed, the desctructor is not invoked.

    Keep in mind, I have tested this with assembly versions 2012.2.607.1050 and 2012.2.912.1050.  I have also profiled the application (and thereby the behavior) using the ANTS Profiler tool.  The Class List found within the ANTS Report clearly identifies multiple instances of the UserControl containing the MaskedTextInput.

    Am I using the controls incorrectly?

    Any help on this matter would be much appreciated.

    NOTE:  I was unable to upload the solution within this forum.  Therefore, I created a support ticket ( 615832 ) and attached the solution accordingly.

  5. Boby
    Boby avatar
    595 posts

    Posted 10 Oct 2012 Link to this post

    Hello Preston,
    Your ticket will be handled by the respective support team. We will continue our conversation there.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Preston
    Preston avatar
    19 posts
    Member since:
    Apr 2009

    Posted 11 Oct 2012 Link to this post


    Thanks for the quick response.  Looking forward to hearing from your team.

Back to Top
DevCraft banner