The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
UWP Navigation leaks native Memory RRS feed

  • Question

  • Hey guys, 

    i have a big UWP-App which crashes after a half hour of using. Now its my job to stop the crashes. I found out that the memory increases dramatically with every Navigate-Call. I tried GC.Collect, but this is not working. It seems to hold the native memory.

    So i know there is a alsmost two year old thread with exact the same topic, but there is no real solution for that. To unsubscribe all events is not possible. I'm wondering why UWP uses native technology in Win 10. Using the NavigationCache is also not possible because my application would have a different behaviour.

    If you need an example just open the Win 10 Settings app and navigate through the pages, the memory is leaking also.

    So is there any way to stop this memory leak?


    VB.NET & C#.NET

    Friday, June 15, 2018 9:27 PM

All replies

  • Hi Nico F,

    I navigate the pages in windows settings, the memory is not leaking. Although the memory will go up, it will come down later. It did not crash. There’re many reasons which will cause memory leak, not necessarily navigation.

    For your question, if you could provide your own reproducible code sample, it would be better. If you could not provide a sample, I suggested that you could open a support ticket. You will get 1:1 support on that. Please kindly note that your support ticket will be free if it is Microsoft's issue. Thanks for your understanding.

    Best Regards,

    Xavier Xie


    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, June 18, 2018 4:56 AM
  • Hey Xavier , 

    sorry for the late response. Which version of windows do you use? I use Windows 10 Version 1803 Build 17134.112.

    If i start the settings app is uses 14,1 MB. After navigating to System and navigating back it uses 21,6 MB. Again 23,1 MB. After waiting a short time it comes down to 22,2 MB. NAvigating again and waiting goes to 23,3 MB. The memory increase on every navigation. The memory is only going down on closing the app.

    So the settings app is a very simple app. In my own app i have much more complex gui. I navigation in my app is horrible because of this memory leak.

    Please check this again with your settings app. The memory is never going down to the level it was before the navigation.

    best regards

    Nico


    VB.NET & C#.NET

    Friday, June 29, 2018 12:53 PM
  • Hey Xavier 

    i wrote a small demo to show how the memory is going away. I have a simple listview. When you press the button, 20 items are put in the listview. The point is the very complex itemtemplate (TestBlockView - a normal page).

    So i think the listview is creating a new itemtemplate view for every item. The memory of the itemtemplate views is not released (the view is never disposed), so the memory is always growing. It starts with 24MB, after 6 clicks on the button we are over 100MB. So what do i wrong?

    Nico

    Download MemoryLeakProof: Download


    VB.NET & C#.NET

    Thursday, July 5, 2018 9:25 PM