-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page weak reference is still alive after pushing and popping pages modally or normally #21143
Comments
We encountered a similar issue. Seeing a lot of memory leaks, especially using NavigationPage |
@jonathanpeppers thoughts? |
@MDThomsen do can you record a We just recently revamped Android instructions here: |
Oh, if the sample uses |
@jonathanpeppers Here is the attached gcdump, where the ContentPage is getting pushed and popped ten times in a row. Yeah, I forgot to make some more concise names for the pages. The MainPage, set in the App.xaml.cs, is a TabbedPage which has one child, which is a ContentPage, that pushes and pops a copy of itself. |
@MDThomsen can you try the latest "nightly build"?
|
Hi @MDThomsen. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Description
Taking inspiration from this guide from Jonathan Peppers I wanted to investigate why I am experiencing memory increases over time when pushing and popping pages both modally and normally.
I am setting up a weak reference to the page that I am pushing, and then popping. After popping I am performing a GC.Collect(), but I notice that the weak reference is still alive afterwards. I would assume that the weak reference would no longer be alive after popping the page from the view hierarchy.
Code sample:
Otherwise please check out the linked sample repo.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/MDThomsen/Weak-Reference-MAUI-Sample/
Version with bug
8.0.6 SR1
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 14
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: