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

Many Controls end up preventing Garbage Collection #19606

Closed
michaelstonis opened this issue Dec 28, 2023 · 6 comments
Closed

Many Controls end up preventing Garbage Collection #19606

michaelstonis opened this issue Dec 28, 2023 · 6 comments
Labels
migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working

Comments

@michaelstonis
Copy link

michaelstonis commented Dec 28, 2023

Description

We have noticed across multiple applications that memory pressure consistently increases until crashing. It appears that this is, in part, related to certain controls not allowing a page to be garbage collected which then has rippling effects (view models, data models, etc.) that prevent any additional objects on that page to be collected.

I've tested this against Android and iOS and the controls that consistently seem to not allow GC are the following:

  • ActivityIndicator
  • Border
  • BoxView
  • ImageButton
  • Slider
  • Stepper
  • Switch
  • TableView
  • ListView (Not in Example)
  • CollectionView (Not in Example)
2023-12-27_20-39-20.mp4

Video shows examples of creating controls adding them as the only control on a page, navigating from the page and invoking the GC.

Steps to Reproduce

  1. Click "Go to Page"
  2. Select one of the controls listed
  3. Navigate back to the home page
  4. Click "Cleanup"
  5. Observe the console output window for messages like GCed page with {Name of View}

Link to public reproduction project repository

Reproduction Repository

Version with bug

8.0.3

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, Android, I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@michaelstonis michaelstonis added the t/bug Something isn't working label Dec 28, 2023
@drasticactions drasticactions added the s/needs-repro Attach a solution or code which reproduces the issue label Dec 28, 2023
@ghost
Copy link

ghost commented Dec 28, 2023

Hi @michaelstonis. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

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.

@drasticactions
Copy link
Contributor

You listed an example but didn't link it. Could you link it please?

@drasticactions
Copy link
Contributor

Also, my guess is that this is a duplicate of #18365, which covers the same topic.

@michaelstonis
Copy link
Author

@drasticactions sorry about that. Link updated and provided here https://github.com/michaelstonis/MauiCleanTest.

I think that this is the same/similar as #18365 I had not found that one when searching before posting this though. The only difference, if anything, is that I am seeing it on iOS, Mac Catalyst, and Android.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Dec 28, 2023
@samhouts samhouts added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Jan 3, 2024
@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Apr 3, 2024
Copy link
Contributor

Hi @michaelstonis. 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.

@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio 17.6.10(build428) (8.0.14). Not repro this issue with sample project.
image

@Zhanglirong-Winnie Zhanglirong-Winnie added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Apr 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants