-
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
FlexLayout Memory leak #10904
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Also references to #9162 (comment) |
Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Windows 11 and Android 13.0-API33 with provided Project: |
Is it possible this is solved by: #13550 Does this problem still occur on .NET 8? |
Hi @xzidez. 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. |
The problem is in your code. This should be your public async Task Update()
{
Items.Add(new Item());
if(Items.Count > 1)
{
Items.RemoveAt(0);
}
await Task.Yield();
GC.Collect();
GC.WaitForPendingFinalizers();
OnPropertyChanged(nameof(Items));
OnPropertyChanged(nameof(InstanceCounterText));
} That said, I think there are more complex use cases where |
I'm asking the MAUI team about #17290. I don't think it actually solves a leak, but there may be some behavior around I do think we can close it, as you've shown in the screenshot. Thanks! |
Description
A flexlayout with ObservableCollection as BindableLayout.ItemsSource will never release any resources that has been in the collection.
Steps to Reproduce
Use public reproduction repo.
Start and click the button. See how instance counter keeps increasing and never decrease.
This is how the layout looks. Nothing strange just a flexlayout with a itemssource.
Viewmodel looks like this
And then the item in question
Link to public reproduction project repository
https://github.com/xzidez/MauiFlexLayoutLeak
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
Android, Windows
Affected platform versions
Any Android or Windows version
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: