Skip to content
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

BindableObjects not getting collected causing memory leak, android #24478

Open
GBarbieri-IPS opened this issue Aug 27, 2024 · 4 comments · May be fixed by #24507
Open

BindableObjects not getting collected causing memory leak, android #24478

GBarbieri-IPS opened this issue Aug 27, 2024 · 4 comments · May be fixed by #24507
Labels
area-core-platform Integration with platforms memory-leak 💦 Memory usage grows / objects live forever migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working
Milestone

Comments

@GBarbieri-IPS
Copy link

GBarbieri-IPS commented Aug 27, 2024

Description

I have a pretty large application that we migrated over from xamarin to MAUI. Seems that after navigating through our app x~40 times we end up with a memory leak causing the application to hang. I've collected memory dumps at the time of the crash which I'll post here.

image (1)
image (2)
image

I can see that MIcrosoft.Maui.Controls.SetterSpecificiityList and BindablePropertyContext seem to be eating up a bunch of our resources as dead objects. I was wondering if there was a way to get these bindings to be cleaned up by the GC as I believe these seem to be the cause of our memory leak? I've tried traversing through the visual tree, removing handlers, setting binding context to null, setting the styles to null, unapplying bindings upon disposal. Can't see to get any progress on resolving this issue.

Steps to Reproduce

  1. Navigating through 5 pages of our app
  2. Navigating back to root
  3. Repeat 22 times
  4. Notice application hangs during OnAppearing or OnPageDisappearing

Link to public reproduction project repository

No response

Version with bug

8.0.21 SR4.1

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

No response

Did you find any workaround?

No workaround yet.

Relevant log output

No response

@GBarbieri-IPS GBarbieri-IPS added the t/bug Something isn't working label Aug 27, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@samhouts samhouts added area-core-platform Integration with platforms platform/android 🤖 migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert labels Aug 27, 2024
@samhouts samhouts added the memory-leak 💦 Memory usage grows / objects live forever label Aug 28, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added the s/triaged Issue has been reviewed label Aug 29, 2024
@PureWeen PureWeen added this to the .NET 8 SR9 milestone Aug 29, 2024
@Toomas75
Copy link

I had problems with SetterSpecificiityList when used BindableLayout and loaded itemtemplate in non ui thread.

@GBarbieri-IPS
Copy link
Author

@Toomas75 Were you seeing similar issues as to what I mentioned? If so how did you get around it? Thanks :)

@Toomas75
Copy link

@Toomas75 Were you seeing similar issues as to what I mentioned? If so how did you get around it? Thanks :)

Just checked my history. It wasn't views leaking problem as you experience.

@PureWeen PureWeen modified the milestones: .NET 8 SR9, 9.0-rc2 Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-platform Integration with platforms memory-leak 💦 Memory usage grows / objects live forever migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working
Projects
Status: Cut from this Milestone
Development

Successfully merging a pull request may close this issue.

5 participants