Silverlight 4 Memory Leak

I have a Silverlight 4 application that has a fuzzy ViewModel class. I confirmed this using WinDbg and the command! Gcroot for my ViewModel type. I could not indicate the exact cause of the memory leak, but tried to resolve it using the following line of code in the corresponding view when it was closed:

HtmlPage.Window.Navigate(new Uri(MyTopLevelUri));   

This causes the application to restart and, therefore, RootVisual is reinitialized. Now, when I use WinDbg, I see that after closing View, there are no more references to the ViewModel class.

However, when I control the memory usage in the application (using SysInternals), it is constantly increasing. This can sometimes go down a bit, but if I continue to open and close the suspicious view, I end up with a private byte memory of more than 1,000,000 K. Also, even if I add code to force the GC, it never restores all the allocated memory . Should I worry?

Are there any built-in memory leaks with SL4 and controls? I do not really believe that a patch was recently released to fix memory leaks using DataTemplates (version 4.0.60129.0 http://timheuer.com/blog/ ).

+3
source share

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


All Articles