Memory Leak in CollectionView Control for .NET MAUI
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
### Description
I've encountered a memory leak issue while working with the CollectionView control in .NET MAUI. To demonstrate the problem, I've created a video recording which shows the memory usage when navigating away from a page containing the CollectionView.
Even after navigating away from the CollectionView page, instances of Model class(ListViewProductReviewInfo) continue to exist in memory. I've verified this using profiling tools, which show that they are not being garbage collected as expected.
### Steps to Reproduce
1.Run the sample .
2.tap on Navigate Button.
3.And navigate back to the previous.
4.Check the reviewInfo model class using profiler
I have included the video reference in the github repository for your reference to replicate the issue
### Link to public reproduction project repository
https://github.com/RiyashameedM/MemoryLeakSample
### Version with bug
9.0.50 SR5
### Is this a regression from previous behavior?
Not sure, did not test other versions
### Last version that worked well
Unknown/Other
### Affected platforms
Windows
### Affected platform versions
Windows 11
### Did you find any workaround?
no
### Relevant log output
```shell
```
Contributor guide
Research direction
Start with the linked MemoryLeakSample reproduction project and run its CollectionView navigation flow on Windows 11. Use a profiler to inspect ListViewProductReviewInfo instances after navigating back, then trace the CollectionView lifecycle in .NET MAUI. Done means those model instances can be garbage-collected after leaving the page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100