I have a UWP Windows 10 App and noticed the memory usage in task manager is increasing over time.
I stripped the App back and found the memory is increasing when the
Every time you navigate to a Page, you create a new instance of Page, but the previous Page is not disposed (even if the Page is already in the navigation stack).
To prevent multiple allocation of same page, set NavigationCacheMode="Enabled"
attribute to the Page.
Also, to minimize the memory allocation, you must override method OnNavigatedTo
and OnNavigatedFrom
.
In OnNavigatedTo
method:
In OnNavigatedFrom
: