navigation - Navigating to page increases memory usage Windows Universal 8.1 -
i'm creating windows universal 8.1 application. everytime navigate page , navigate , page 1 time again new instance of page beingness held in memory. garbage collector frees memory after while, i'd rather not utilize memory if it's unneeded. there way recycle or dispose of these pages?
in windows uriversal app, can utilize navigationcachemode recycle page. can set in constructor of page. example, there mainpage want recycle:
public mainpage() { this.initializecomponent(); // set navigationcachemode of page enabled. // page cached, cached instance discarded when size // of cache frame exceeded. this.navigationcachemode = windows.ui.xaml.navigation.navigationcachemode.enabled; // or set navigationcachemode of page required. // page cached , cached instance reused every visit // regardless of cache size frame. // this.navigationcachemode = windows.ui.xaml.navigation.navigationcachemode.required; } after setting it, can go mainpage without re-create it.
if navigationcachemode set disabled. memory of page released when onnavigatedfrom it.
there similar question so: page constructor gets called 1 time again when navigating in windows 8 c# app
windows navigation windows-phone-8.1 windows-universal
No comments:
Post a Comment