Skip to content

Android: Memoryleaks when using FlyoutPage with NavigationPages #33355

@3sRykaert

Description

@3sRykaert

Description

In Android (didn't test on Windows/IOS/MAC) my app is crashing cause of memory leaks in Maui when using a FlyoutPage with NavigationPages.
Navigating to different pages like this, causes memory increase and eventually the app becomes slow and unusable.

Weird thing is:
When I change masterPage.Detail = new NavigationPage(page); in NavigationService.cs to masterPage.Detail = page; no memory leaks seem to happen. But then the "hamburger menu" is missing in the FlyoutPage which is needed in my app.

Steps to Reproduce

  1. Run the App on an android device
  2. Click the button to navigate to DetailPage1
  3. In DetailPage1 click the button to navigate to DetailPage2
  4. Wait a few seconds and the nuget package from https://github.com/AdamEssenmacher/MemoryToolkit.Maui "displays" all the leaks from DetailPage1 in an Alert popup
  5. In DetailPage2 click the button to navigate to DetailPage1
  6. Wait a few seconds and the nuget package from https://github.com/AdamEssenmacher/MemoryToolkit.Maui "displays" all the leaks from DetailPage1 in an Alert popup
Image

Link to public reproduction project repository

https://github.com/3sRykaert/MauiMemoryleak

Version with bug

10.0.20

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11 and up (didn't test on other platforms)

Did you find any workaround?

No

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-navigationNavigationPagei/regressionThis issue described a confirmed regression on a currently supported versionplatform/androidregressed-in-10-preview1s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions