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

Potential Memory Leak?

4 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Preston
Top achievements
Rank 1
Preston asked on 01 Oct 2012, 02:40 PM
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

PD

4 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 04 Oct 2012, 11:51 AM
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.
 
Regards,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Preston
Top achievements
Rank 1
answered on 09 Oct 2012, 05:23 PM
Petya,

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.

Thanks
PD
0
Boby
Telerik team
answered on 10 Oct 2012, 06:45 AM
Hello Preston,
Your ticket will be handled by the respective support team. We will continue our conversation there.

Greetings,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Preston
Top achievements
Rank 1
answered on 11 Oct 2012, 12:52 PM
Boby,

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

PD
Tags
General Discussions
Asked by
Preston
Top achievements
Rank 1
Answers by
Petya
Telerik team
Preston
Top achievements
Rank 1
Boby
Telerik team
Share this question
or