Deleting project/pages/usercontrols from memory

前端 未结 3 1327
滥情空心
滥情空心 2021-02-18 16:10

I have made a windows phone app, that unfortunately has some memory leak, because pages are not removed correctly. This was solved by using the answer:

Remove Pages wind

相关标签:
3条回答
  • 2021-02-18 16:31

    Beware of third party controls/libraries, Image, LongListSelector, FlipView or WebView, because they have some issues with memory management.

    You should make sure, that no threads/tasks/timers keep reference to your Views/ViewModels.

    There are two interesting articles about memory leaks:

    • Memory Leaks in WPF applications
    • Managing Memory in Windows Store Apps

    I guess it will be hard to find the root cause without any sample project. If it doesn't occur in empty project with the same architecture, then there is some issue in your code.

    0 讨论(0)
  • 2021-02-18 16:32

    Find all disposable graphics/IO, make sure that disposed them, (after you finished to use them).
    The all such objects inheriting from IDispose interface.

    0 讨论(0)
  • 2021-02-18 16:33

    I think you can make the object singleton and you can clear the values of objects manually when accordingly. Please refer the link below https://msdn.microsoft.com/en-us/library/ff650316.aspx

    0 讨论(0)
提交回复
热议问题