Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Change pages and memory management

$
0
0

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
Navigation.PushAsync(newpage);

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!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>