Hi Support,
We are experiencing a memory leak issue in our WPF application when using the esri:MapView control from the ArcGIS Runtime SDK.
We are using Prism with DryIoC to dynamically load and unload views at runtime.
Our application uses a custom RegionAdapter and RegionActiveAwareBehavior to manage the lifecycle of views within regions.
Here is the problem:
<esri:MapView x:Name="EsriMapView" />
<esri:MapView x:Name="EsriMapView" Map="{Binding Map}" />
then a memory leak occurs. The view is removed from the region, but the MapView and its associated resources are not released, even after explicitly clearing layers and unsetting the map reference.
In the view's unload logic, we attempt the following cleanup:
if (EsriMapView.Map is Map map)
{
map.OperationalLayers.Clear();
map.Basemap?.BaseLayers.Clear();
}
EsriMapView.Map = null;
Despite this, memory is not released properly, and repeated navigation results in increased memory usage.
For your reference I have attached the sample application. I’m to using ViewA of ModuleA which is inside the DevExpress LayoutControl control.
Please let me know if you have any suggestions on how to avoid this memory leak.
Thanks!
-Ben