Forum Xamarin Xamarin.Forms

Change pages and memory management

MarcoTMarcoT USMember ✭✭

Hi all,
I almost complete my app with Xamarin forms (I think that Xamarin.forms is really a fantastic tool, even if it has a lot of bugs).
The result is really good, but now I have a problem with memory management.

Sometimes I change page using

and in this case I have no problem with memory.

Other times I need to change the root page so I don't use the push/pop method but I use this code:

Mynav = new NavigationPage(newpage) { };
MainPage = Mynav;

The result is what I expect, but after 4 or 5 times, the app crashes because there is no more memory available.
So I suppose that when I create a new NavigationPage and assign it to the MainPage, the old one is still in memory.

What is the proper way to create a new navigation page? (and release the memory occupied from the old one)

Thank you!


Sign In or Register to comment.