iOS PopModalAsync causes memory leaks #21453
Labels
area-controls-modal
legacy-area-perf
Startup / Runtime performance
memory-leak 💦
Memory usage grows / objects live forever
migration-compatibility
Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert
partner/cat 😻
this is an issue that impacts one of our partners or a customer our advisory team is engaged with
platform/iOS 🍎
s/triaged
Issue has been reviewed
t/bug
Something isn't working
t/perf
The issue affects performance (runtime speed, memory usage, startup time, etc.)
Milestone
Description
Whne you push a modal page that is wrapped in a NavigationPage
Navigation.PushModalAsync(new NavigationPage(new ModularPage()));
on iOS we can see that the Page is never released from the memory. We are using Perfiew for debugging.Here is a GCDump where we open and close a modal page multiple times
20240326_110245_0.zip
I am adding a sample which has both solutions outcommented. Seems counterintuitive that we need to call DisconnectHandler on existing pages and controls when popping a page from the Navigation stack.
NavigationSample.zip
Steps to Reproduce
Link to public reproduction project repository
No response
Version with bug
8.0.6 SR1
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
Seems that this can only be fixed by running disconnectHanler on each element on the Page including the page
or creating a custom handler for the NavigationPage and running
Relevant log output
No response
The text was updated successfully, but these errors were encountered: