Update: Memory leak is due to pages not unregistering the handler for view model's PropertyChanged events when navigating away. The ViewModel keeps a hard reference to the Page, so somehow both cannot be GC.
Looks like Pages don't get efficiently cleaned up when they are navigated away from. New Page instances are created on every navigation and never get properly released. It's confirmed to be a system-level memory leak. 🤦 Set NavigationCacheMode to Enabled can fix that.
Update: Memory leak is due to pages not unregistering the handler for view model's PropertyChanged events when navigating away. The ViewModel keeps a hard reference to the Page, so somehow both cannot be GC.
Looks like Pages don't get efficiently cleaned up when they are navigated away from. New Page instances are created on every navigation and never get properly released. It's confirmed to be a system-level memory leak. 🤦 Set
NavigationCacheMode
toEnabled
can fix that.https://learn.microsoft.com/en-us/answers/questions/111194/memory-leak-on-uwp-with-target-versions-10-0-17763 https://github.com/microsoft/microsoft-ui-xaml/issues/934 https://github.com/microsoft/microsoft-ui-xaml/issues/3597