Select to view content in your preferred language

Memory leak when using MapView in a Shell application with multiple tabs

295
3
Jump to solution
05-29-2024 09:34 AM
Labels (2)
esp1rl
by
New Contributor III

When switching tabs back and forth memory usage will increase for no good reason. The memory increases when switching TO the page with the MapView. It rapidly increases to multiple gigabytes and the application is killed by the OS.

Please see repro code and my findings (in the readme) at GIT repository

issue-repro/arcgis-maps-maui-v200.4.0-high-memory-usage at main · espenrl/issue-repro (github.com)

TLDR

  • Memory increase in Total PSS, Total RSS, Graphics, EGL mtrack and GL mtrack
  • Reproduces every time on a Samsung S22 Plus device
  • Does NOT reproduce on Android emulator for Windows
  • No difference using GC.Collect(generation: 2)
  • No difference between debug and release builds
  • Potential issue from ADB logcat

 

0 Kudos
1 Solution

Accepted Solutions
HamishDuff
Esri Contributor

Hi @esp1rl thank you for your question and attached reproducer. 

I was able to reproduce your issue on a Motorola g200 5g using 200.4.0 nuget packages. This didn't occur initially but when I zoomed in on your data and rapidly moved between tabs I triggered the memory leak and crashed the app.

I then tested your reproducer with 200.5.0 packages which will be available in the next release. This includes improvements to memory handling for .NET MAUI Android. In my testing I was not able to reproduce the crash with 200.5.0 packages. 

Your issue should be resolved in the next release, if it is not please post again and we can take another look.

View solution in original post

0 Kudos
3 Replies
HamishDuff
Esri Contributor

Hi @esp1rl thank you for your question and attached reproducer. 

I was able to reproduce your issue on a Motorola g200 5g using 200.4.0 nuget packages. This didn't occur initially but when I zoomed in on your data and rapidly moved between tabs I triggered the memory leak and crashed the app.

I then tested your reproducer with 200.5.0 packages which will be available in the next release. This includes improvements to memory handling for .NET MAUI Android. In my testing I was not able to reproduce the crash with 200.5.0 packages. 

Your issue should be resolved in the next release, if it is not please post again and we can take another look.

0 Kudos
esp1rl
by
New Contributor III

Thanks for the update @HamishDuff 

I did a new test with MAUI v8 SR6 as it has some fixed some memory leaks, but the same problem persists. I guess I will have to wait for 200.5.0

0 Kudos
esp1rl
by
New Contributor III

@HamishDuff do you have a NuGet feed for beta packages of 200.5.0 ? Would love to test it and make sure that the problem is fixed. If not there will be a long wait for a fix in the next release after.

0 Kudos