-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Memory Leak with CollectionView #14993
Comments
Yes its a memory leak I am also having this issue on android though. It generally happens when items being added/removed from a CollectionView very frequently rather then fixed data source that load only once. Might be related to |
This might be related, depending on the underlying cause. However, I do not replace my ItemSource over and over. This increase (1Gb memory for a 3Mb database) happens on the very first assignment of the property that ItemSource has a binding to. Pressing the parse button again, causing a reassignment of the ItemSource, it will rise to more than 2Gb memory. So I do see that issue as well, however, my initial memory usage is already much bigger than it should be. |
I would suggest try ListView with HasUnevenRow="False" if possible Or one of below https://github.com/roubachof/Sharpnado.CollectionView |
VerticalStackLayout does not constraint its content, therefore your CollectionView grows infinitely, rendering all the items at once. |
Duplicate of #8097. |
I didn't know about the issue with VerticalStackLayout. That helped a little. I don't remember seeing that in the CollectionView docs last time I looked. However, I would still say it needs to much memory. There are less than 2k items, and they only have a string and an int property and two very small commands. Of course the Collectionview needs the template every time, but even with that the memory usage seems very excessive. |
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. |
@jonathanpeppers would this b better with all the perf work you are doing? |
I think someone should just retest this one w/ main or .NET 8 where we have the fix: |
Memory leak issue, we verified this issue with Visual Studio Enterprise 17.9.0 Preview 2.1. Can repro on windows platform with sample project. |
Description
Hi,
I wrote a small tool to download a radio stations playlist for me to look through, very small and simple, and it works. But for some reason for a little over 1k items (less than 3Mb database file size) the app needs more than 1Gb of memory. So there is either a memory leak I don't see, I'm using the CollectionView in a way than I shouldn't or there is a bug somewhere in MAUI / CollectionView
Steps to Reproduce
My app is a new MAUI project in VS, only the MainPage files were modified, I didn't want to spread this little code over multiple files. Code is in the repo.
On first startup (no db file) it starts at ca. 120Mb, goes up when I use the parse button to 140Mb and the moment the CollectionView loads the files it blows up to more than 1Gb.
Link to public reproduction project repository
https://github.com/THoferSchmitz/Playlist-Downloader
Version with bug
6.0.312
Last version that worked well
6.0.312
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows SDK 10.0.17763.0
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: