maui
maui copied to clipboard
FlyoutPage memory leaks - iOS, MacCatalyst
Description
The weak references of FlyoutPage's handlers, controls, references are not being deallocated, and stays in the memory. For more compex views (like having a map and several images on the detail page) two assignment could be enough to crash the application completely. Issue Affecting .90, .92 versions iOS and macOS for sure, i have not had time to test it on other platforms.
Steps to Reproduce
Constatly assign a new instance of a FlyoutPage to the Application.Current.MainPage.
Link to public reproduction project repository
https://github.com/banditoth/Maui.Sample.FlyourPageMemoryleak
Version with bug
8.0.92 SR9.2
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
No response
Affected platforms
macOS, iOS
Affected platform versions
iOS 18, MacOS 15
Did you find any workaround?
No response
Relevant log output
No response
We fixed a lot of this in .NET 9
Can you test on .NET 9?
Hey @PureWeen
Tested out on .NET 9, the issue does not persist, if i did everything right:
Setting the MainPage on button click with : Application.Current.Windows[0].Page = new MemoryFlyPage();
And overriding the app.xaml.cs's with this:
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new MemoryFlyPage());
}
Perfect, seems fixed then. Thanks for letting us know!