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

iOS/Catalyst memory leak with CollectionView when CollectionChanged is used #16125

Closed
Tracked by #14654
jonathanpeppers opened this issue Jul 12, 2023 · 3 comments
Closed
Tracked by #14654
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView memory-leak 💦 Memory usage grows / objects live forever (sub: perf) migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst 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 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Milestone

Comments

@jonathanpeppers
Copy link
Member

Description

This is the latest problem on the issue here: #14654

It can be illustrated with the test: jonathanpeppers@bbea059

When you replace an ItemsSource on iOS, in this way:

var newCollection = new ObservableCollection<string>();
collectionView.ItemsSource = newCollection;
foreach (var item in data)
{
    newCollection.Add(item);
}

It appears that the old items are not removed, the test fails with:

Expected: 3
Actual: 6

But passes on Windows & Android. The test also passes if you change this:

var newCollection = new ObservableCollection<string>();
--collectionView.ItemsSource = newCollection;
foreach (var item in data)
{
    newCollection.Add(item);
}
++collectionView.ItemsSource = newCollection;

However, the sample app still leaks with the above change:

https://github.com/nacompllo/MemoryLeakEverywhere

I've not been successful in solving this one, but it seems good to write down what I found so far.

Steps to Reproduce

Run the test in: jonathanpeppers@bbea059
Or try the sample: https://github.com/nacompllo/MemoryLeakEverywhere

Link to public reproduction project repository

https://github.com/nacompllo/MemoryLeakEverywhere

Version with bug

8.0.0-preview.5.8529

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

All

Did you find any workaround?

No response

Relevant log output

No response

@jonathanpeppers jonathanpeppers added t/bug Something isn't working platform/macOS 🍏 macOS / Mac Catalyst platform/iOS 🍎 memory-leak 💦 Memory usage grows / objects live forever (sub: perf) labels Jul 12, 2023
@rachelkang rachelkang added this to the Backlog milestone Jul 13, 2023
@ghost
Copy link

ghost commented Jul 13, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@kevinxufei
Copy link

According to the project provided by the user, it was verified that there is no memory leak on 17.6.8 (build 400).

@kevinxufei kevinxufei added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Jan 31, 2024
@ghost
Copy link

ghost commented Jan 31, 2024

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

@ghost ghost closed this as completed Feb 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2024
@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) and removed legacy-area-perf Startup / Runtime performance labels May 10, 2024
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView memory-leak 💦 Memory usage grows / objects live forever (sub: perf) migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst 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 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Projects
None yet
Development

No branches or pull requests

5 participants