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

Memory Leak on RadTransitionControl

1 Answer 60 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 23 Oct 2013, 12:34 PM
I'm using the RadTransitionControl to animate between photos. Every 3 seconds the folowing code runs:

Content.Content = new Image() { Source = new BitmapImage(Images[currentImageNumber]), Stretch = ImageStretch };
(Content is the RadTransitionControl and Images is an array of URIs)

After 5 minutes of running this code the app crashes with an OutOfMemoryException. Seems the image is not being disposed after a new Image has been assigned as content.

Changing the content to null before changing the image doesn't look great but it stops the OutOfMemoryException exception occurring:

Content.Content = null;
Content.Content = new Image() { Source = new BitmapImage(Images[currentImageNumber]), Stretch = ImageStretch };

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 25 Oct 2013, 12:13 PM
Hi James,

Thank you for writing.

You can read this blog post about Images and pay attention to the Image Caching section. The blog post describes how the Images that you load are cached in the memory so that in case you need to display them again they will be loaded faster. However, this behavior often leads to very high memory consumption, as it is in your case. This means that you will need to set the the Source of the Image object and the UriSource of the BitmapImage object in order to make sure that the images don't stay in the memory.

I hope this information helps. Let us know if you need further assistance.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
TransitionControl
Asked by
James
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or