MAUI memory use and pages not get garbage collected? #20125
Unanswered
JoacimWall
asked this question in
Q&A
Replies: 2 comments 4 replies
-
Hi @JoacimWall |
Beta Was this translation helpful? Give feedback.
2 replies
-
I also have terrible problems with GC in MAUI, which is practically non-existent, every time you open and close a page, more and more is accumulated in memory, and little is unloaded, the load / unload ratio is always in deficit, even manually calling the GC periodically, it seems that the main problem is that the references are not abandoned. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
We have an app running on latest MAUI 8.0.6 same for 8.0.3 that just keeps growing and growing in memory when we run it in debug or Release. I know you should test this in release mode but can't get it to work.
Another thing is that XCode Instruments doesn't seem to work with MAUI.
Have also tried running the same app via the Apple App Store as macCatalyst in Release mode sees the same behaviour in the Activity Monitor on Mac where the memory usage only increases. I can see that if I run
GC.WaitForPendingFinalizers();
GC.Collect();
and
GC.GetGCMemoryInfo();
the memory decrease but I think the memory that increases is not handled by the dotnet GC but mono perhaps or something native?
So I created a simple test app:
This test app is only a main page and a second page with an image.
I bind Image.Source to an image and navigate back and forth and the memory usage just goes up.
If I decide to set Image.source = null in OnDisappearing then the memory usage does not grow as much but still it seems that the page is not handled by the GC.
The app increases with 70mb for showing a image that is 3mb every time I navigate to the page.
In case we try to make a similar app in Xcode native swift. The same app use 16 mb instead of 240 mb for MAUI. And the app is not increasing in memory use in Activity monitor.
So my questions is has anyone else seen this and is it something that I missing.
//Joacim
Beta Was this translation helpful? Give feedback.
All reactions