Is Xamarin Forms navigation stack garbage collected? When I click to button and open a page using Navigation.PushAsync() it will keep other page in navigation stack or relase memory?
1 Answers
1
votes
The Navigation stack is a Stack interface, which you can generally think of like a stack of silverware in a drawer. When you add a fork to the drawer, you put it on top of the other forks, and when you remove a fork you always remove the top one. A stack is a first-in-last-out data type. When you do add a fork on the top, though, all the other forks are still there below it.
This is the same with the navigation stack. When you add a page using PushAsync(newPage), newPage is placed on the top of the navigation stack, but all the pages before it are still below it. That way when you call PopAsync() you will return to the previous page and it won't have to completely remake it.