Select to view content in your preferred language

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

743
4
Jump to solution
05-29-2024 09:34 AM
Labels (2)
esp1rl
by
Occasional Contributor

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
4 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
Occasional Contributor

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
Occasional Contributor

@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
PreetiMaske
Esri Regular Contributor

@esp1rl , ArcGIS Maps SDK for .NET was released mid of August 2024. Were you able to test your workflow with the latest version? If yes, is it working as expected? 

0 Kudos