Memory Leak on RadTransitionControl

2 posts, 0 answers
  1. James
    James avatar
    1 posts
    Member since:
    Oct 2011

    Posted 23 Oct 2013 Link to this post

    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 };
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 25 Oct 2013 Link to this post

    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.
  3. DevCraft banner
Back to Top