-
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
[IOS] Dotnet 9 Memory leaks: BindableLayout leaks if nested inside a CollectionView, CarouselView ...etc #26042
Comments
We've found some similar issues:
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
|
Ah yes, sorry for that it makes perfect sense. The first issue wasn't something i noticed in production code only in the test project and i found it very weird. Thank you very much! That leaves us with the second IOS issue then (that drove me to create the test project in the first place) |
I just updated the Title and the sample project with the correction of the first problem to not waste dev time |
Thank you @PureWeen for your time. I reproduce without the debugger attached : / but your test gave me a clue. I was testing on IOS 17.5 and i reproduce consistently. This is very good news, i can at a minimum ask some of my clients to update their devices. But for those with older devices it will be complicated ^^ |
Description
After updating to .Net 9, i have 2 new memory leak behaviors:
1 ViewModel never removed if it contains a collection that is the ItemsSource of some control:**If a ViewModel, which is the BindingContext of a page, contains a collection (List, ObservableCollection ..etc), and that collection is bound to the ItemsSource of a control (BindableLayout, CollectionView ...etc) ====> The ViewModel is never garbage collected !I would like to specify that the control in question IS garbage collected, no issues on the display level, it's the ViewModel itself that stays in memoryThis bahavior is consistent across platforms (tested Android, IOS and Windows)To be ignored i was just a mistake on my part ^^'
2 BindableLayout nested inside another control such as CarouselView, CollectionView or another BindableLayout is never garbage collected
In this case, not only the ViewModel remains in memory, but the BindableLayout (Grid, AbsoluteLayout, StackLayout...whatever) and, of course, this leak cascades and THE ENTIRE PAGE remains in memory!!!!
This behavior is only reproducable on IOS, on Android and Windows the page is garbage collected
Might be important: The combo CollectionView inside CollectionView doesn's cause an issue, only BindableLayout inside some other collection (in my example it's a BindableLayout inside a CarouselView)
Steps to Reproduce
Link to public reproduction project repository
https://github.com/GUELIANEBelkacem/BindableLayoutLeakyApp.git
Version with bug
9.0.10 SR1
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.92 SR9.2
Affected platforms
iOS, Android, Windows
Affected platform versions
Latest
Did you find any workaround?
Quit my job :)
Relevant log output
The text was updated successfully, but these errors were encountered: