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

    Question

  • 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

Answers

All replies

  • I think that you need Data Virtualization as explained in this article:
    http://msdn.microsoft.com/en-us/library/windows/apps/hh780657.aspx

    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
    Moderator
  • 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

    http://connect.microsoft.com/VisualStudio/feedback/details/761770/metro-apps-with-c-heavily-leaking-memory

    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