Gridview with images from web using a lot of resources on RT.


  • I'm using a gridview to show image thumbnails for images on the internet.  I'm using an image control and binding to the object's "imagesource" property, which returns a new bitmapimage(uri).  I also have a local default image to use if the requested image is too big.

    What I do is first test the size of the image by requesting the header.  If the image is larger than the threshold, then I just use the default local image.

    I have the image controls set to cache the image, which does help a little.  but if a person loads 100+ tiles (which is very possible) the memory usage skyrockets up to 400MB.

    My question is, is there a better way to bind the image source?  I've tried to a url string but that cause huge performance issues.  It seems that binding to an image source make for better, smoother loading.

    Also, what threshold should I set for an acceptable image size?  100KB?

    Are there any tricks to optimize the usage so that the resources aren't out of control?  

    Thursday, March 6, 2014 3:01 PM


All replies

  • I think that you need Data Virtualization as explained in this article:

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, March 6, 2014 8:47 PM
  • I'm sorry, I should have mentioned that I'm already using incremental loading.  Which is one of the methods described in the article.

    I did come across this bug report


    And I wonder if it's what's happening with me.  The resource use does fluctuate, which leads me to believe that it's not a leak.  But as the user scrolls more and more data gets loaded, but the memory usage seems to be too high for the usage.

    I am using inotify and two way binding. I'll have to refactor the object and the control and see if it makes a difference.

    Thursday, March 6, 2014 9:12 PM
  • After looking at my code, my filesize check was in the wrong place.
    Friday, March 7, 2014 12:31 AM