WP8 Massive Memory Leaks

I have a very hard time with memory leaks in a fully developed application. C # with MVVM Light 5. I spent all this week exploring the use of a memory profiler, reading information about common memory leak problems, etc. Etc. I put at least 25 hours on this problem. I thoroughly clean all event handlers and even delete the DataContext and LayoutRoot of each page after BackNavigation, as well as when circular navigation is detected (I save the last launched instance of the page in App.cs, when another instance of this page has to be created, I check if it has already been instance, and if so, I clean it).

I have exhausted my efforts, and I do not know where to go from here.

Below is a link to a screenshot of memory analysis after repeatedly moving between 2 pages. For some reason, instances of each page are not freed, but they are reduced to simple bytes.

enter image description here

As you can see, the difference between my saved selections and saved visual effects from the beginning and the end is very small (only about 30 mb).

However, on the graph, I see a difference of almost 100 mb.

It drives me crazy, I thought the base platform would be better at handling this. Any help is appreciated.

+6
source share
1 answer

I thoroughly clean all event handlers and even exclude the DataContext and LayoutRoot of each page after BackNavigation

I recommend that the system be implemented for reuse of virtual machines, and only acquire new data if it is really necessary. I was working on a professional mapping application, currently in the WP repository, where we only created elements as needed and never created a virtual machine twice.

0
source

Source: https://habr.com/ru/post/980725/


All Articles