image - Memory usage of Windows Phone app keeps building up when going back and forth between pages -


i writing sample windows phone 8.1 app album maker. app, can choose photos gallery , make them album.

features:-

  1. if albums have been created me, first picture of each album displayed when start app.(lets call page 'allalbumsview')
  2. if click on picture in allalbumsview, taken specific album(lets call page 'editpage') , can view pictures of album.
  3. if click button editpage, again taken allalbumsview.

now, problem facing is: if have 1 album having 3 pictures, , if go allalbumsview editpage , allalbumsview clicking on button , again , again, memory used app keeps on building.

i investigated through memory diagnostic tool of visual studio , found when went editpage allalbumsview, memory usage didn't go down(i.e. images of album being viewed still in memory). when opened editpage again clicking on album, memory usage increased images again loaded.(so, have multiple copies of images in memory)

what want is: when go editpage images should loaded memory when go allalbumsview page, images should discarded automatically garbage collector. right now, garbage-collector not cleaning images in memory when go allalbumsviewpage

can help?

thanks

you not clearing references of objects using.

ok,you can before loading startup allalbumsview page in onnavigatedto handler:

deployment.current.dispatcher.begininvoke(() => {    while (navigationservice.cangoback)    {       navigationservice.removebackentry();    } }); 

so on press when onnavigatedto called stack empty no memory should occupied,you can go next screen, again back, again stack empty , on...thats it.also, must sure ovveriding backkeypress event handler no new navigation should there.hope helps.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -