WP7 - Xaml Pages and Peak Memory problem

徘徊边缘 提交于 2019-12-11 07:39:27

问题


I have a problem with 90mb peak memory limit issue.

For example: I create 1 Panorama Application(with default content) and add 3 PivotPages or 6 Portrait Page(Page A and Page B.. with blank content). Each time I navigate and go back between these pages the memory usage is going higher and higher. At the end, It passes the 90mb limit.

I use buttons to navigate like this:

private void btn1_Click(object sender, RoutedEventArgs e)
{
    NavigationService.Navigate(new Uri("/PageA.xaml", UriKind.Relative));
}

Do I miss something important while navigating between pages? While searching for a solution I heard about garbage collector? How can I use it or do I need to?

I couldn't find an answer for that; I found this similar topic: http://forums.create.msdn.com/forums/p/76007/466968.aspx but there isn't a final solution.

Note: I am using Coding4fun toolkit to measure memory usage.


Edit: I created a sample panorama application with some pivot pages (1 with content).

http://i54.tinypic.com/zfip.jpg

At start, application opened with 30mb. After I navigate to the same pivot page a couple of times, Peakmemory started to increase little by little and stoped at 47mb. Is this normal? Maybe, I didn't understand the dynamics of this application building stuff. But it doesn't make sense if it keeps increasing the ram usage and makes application crush after some use.


回答1:


Somethign is stopping your pages from being unloaded when you navigate away from them. You probably have a resource leak somewhere but without seeing your code we will be very unlikely to be able to help more.

You shouldn't need to worry about garbage collection.



来源:https://stackoverflow.com/questions/6944918/wp7-xaml-pages-and-peak-memory-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!