none
[UWP]UWP Navigation Memory Leaks RRS feed

  • Question


  • I have try to develop UWP App, but i have find many problems with memory leaks, using simple project when switch from page to other page the memory is not free using visual studio diagnostics. Other user have same problems?
    for reproduce the problems i have prepared a sample project

    http://www.fasthomestore.it/UWPNavigation.zip

    Compile, start project, start visual studio diagnostic, wait 30 minutes, the memory increase continually


    Friday, May 4, 2018 7:47 AM

All replies

  • Hi,

    Please change the NavigationCacheMode from Disabled to Required. This will ensure the app not create a new instance of the page every time when navigating to it.

    Like this:

    this.NavigationCacheMode = NavigationCacheMode.Required;

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 7, 2018 6:36 AM
    Moderator
  • Hey Roy, 

    i have the same problems, but i dont want use the cache becaues every view is in exact the same state as the user left it. So in my app i want that the user has a cleaned view in initial state.

    So do you know, how to dispose a view that was created by the navigation system?

    Nico


    VB.NET & C#.NET

    Friday, June 1, 2018 5:00 PM
  • I leave my comment here, although it's an old post, for others that might search for it.

    We made huge improvements in memory handeling and GC calls with latest UWP 6.2.9 Nuget update while targeting >=RS4. The complete release notes are github.com/microsoft/dotnet/blob/master/releases/UWP/net-native2.2/README.md
    Friday, September 20, 2019 10:27 AM