0
votes

I have test application:

http://www.mediafire.com/download/y5nxo6esifys4h0/LeakMemLLS.rar

It consists of 2 pages:

  1. Main Page.

  2. ListItems Page (use LongListSelector).

When I go to ListItems page and back to Main page many time. The memory is increase.

Does anybody know what is the problem?

Thanks.

2

2 Answers

0
votes

When you navigate back from PhoneApplicationPage, and then again to it, runtime create a new instance of it. Therefore this memory increase you see. Usually it's okay, since garbage collector will reclaim the unused instances when it will be necessary.

0
votes

You have to clear stack every time when reach onNavigateTo() of any page,all pages are maintain in stack and GC.Colect() can not remove your stack.

int a = NavigationService.BackStack.Count();
        while (a > standerdCount)
        {
            this.NavigationService.RemoveBackEntry();
            a = NavigationService.BackStack.Count();
        }

standerdCount is stack count when app reach to page first time.

Alternatively you can use NavigationService.GoBack() when navigate from ListItem Page to MainPage.