c# - how to optimize performance of longlistselector with images on windows phone? -


i have page pivot containing 10 items, each pivot item contains longlistselector 30 items each.

each longlistselector item contains image.

when i'm browsing page , flip next pivot item, app crashes @ 4th pivot item memory exception.

is there anyway unload undisplayed images in longlistselector?

i suggest rethinking app layout, 10 pivot items tad many normal user navigation, why not have main page longlistselector of "categories" follow details page of 30 images.

but if absolutely have way, take @ microsoft's photohub source

i'm using , have no problem loading hundreds of images in panoramaitem.

better still if can afford time, memory profile , bloat is, might part of application hogging on memory.

last of all, wp caches images automagically, not likes way (i'm sure don't)

take @ this:

image caching

this important one, , msdn silent it. if ever wondering why image memory didn't released after clearing source , removing image tree, seeing image caching in action. intended performance optimization, avoid (down)loading , decoding same image on , on again. instead keep cache in memory can , reuse. not confuse browser cache downloaded files.

while nice , free performance optimization, @ times can blow memory unnecessarily, when cycle through many images never come to. cache use memory lifetime of app. news can delete cache when decided no longer need it:

bitmapimage bitmapimage = image.source bitmapimage; bitmapimage.urisource = null; image.source = null; 

being smart can save quite bit of memory usage, precious resource on phone device. in sample app, go "caching" page , monitor memory usage show/clear image. check box , try again. see difference of ~3mb in example case.

you can full article here


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -