Hello.
The current ArcGIS Runtime v200.3.0 with the current .NET Maui from VS 17.8.5 has a big memory leak which causes our app to crash on a real world Android device just after a few page changes to the map.
I can reproduce this behavior on any real world device. There the app crashes. The emulator though just allocates more and more memory of course.
I have created two simple apps (see ZIP file).
One is MAUI8+v200.3.0 (Map8 in the video).
One is MAUI7+v200.2.0 (Map7 in the video).
You clearly see the memory of the process qemu-system-x86_64.exe (Android Emulator) go up each time the loaded map gets displayed again by almost 1 GByte on the Map8 app.
On the Map7 app it almost stays the same (On the very top of the video you see the Task Manager with the process, CPU and Memory Usage):
All both apps are doing is creating a map and loading 44 KMZ files with a total of 10MByte. Here is the MainPage.xaml.cs:
using System;
using System.Threading.Tasks;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Ogc;
using Microsoft.Maui.Controls;
using Map = Esri.ArcGISRuntime.Mapping.Map;
namespace ArcGISTry1;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
// Create the UI, setup the control references and execute initialization
_ = Initialize();
}
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
private async Task Initialize()
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
// Set map to mapview
MyMapView.Map = new Map(BasemapStyle.OSMLightGray)
{
InitialViewpoint = new Viewpoint(new MapPoint(11.406534, 47.719954, SpatialReferences.Wgs84), 6000)
};
MyMapView.Loaded += OnLoaded;
}
private async void OnLoaded(object? sender, EventArgs e)
{
for (var i = 0; i <= 43; i++) {
var dataset = new KmlDataset(new Uri($"http://soko.yourweb.de/kmz/MemoryLeak/{i:00000}.kmz"));
await dataset.LoadAsync();
var kmlLayer = new KmlLayer(dataset);
MyMapView.Map!.OperationalLayers.Add(kmlLayer);
}
}
}
Those KMZ files are from my production environment and get loaded like this every day by the users which currently use MAUI7.
Please look at this as soon as you can as I have to do another release in February and with this big bug its impossible to do so.
A workaround would help as well if no pre-release is possible until then.
As mentioned already: This is not an Emulator issue! Its just a good and easy way to show/see the problem. After switching pages on the emulator for 1-2 minutes the process used more than 64GByte on my machine.
On the real device (4 and 6 GByte) it only survies a couple a switches....
thanks
Soko
PS: on the Map7/MAUI7 app you have to move your finger over the map after switching back from the notes-page. This is a known bug in ArcGIS 200.2.0 (see my other post for this).
Solved! Go to Solution.
Wow @MatveiStefarov .
Thats sounds like a kind of bug you want to come along only once a decade 😁
Funny enough that everything worked great until .NET8/MAUI8?!
Anyhow...thanks again!