Hi,
We have a vtpk file on our device which we use to generate the map in offline mode.
Following is the code that we are using currently to do this. We found out that once the map is loaded the memory in the background keeps increasing and is never released.
In our Xamarin Forms UWP application, we use this map on the HomePage and few other following pages. As we navigate in the app, the memory in the background keeps growing and is never released.
We investigated this further and think that the lines 6 and 8 where we load the tiled layer from file on device, the "tilecache" and "vectorTiledLayer" are never disposed from memory. We also looked up if we can use IDisposable interface to dispose objects but seems like these two objects don't implement this interface.
What is the best and efficient way to load the offline vtpk file without affecting the memory much?
What we are doing below, is this the standard way of loading offline files?
var mapPackageFolder = Constants.TpkFolderLocation;
var mapPackageFile = @"Tas_WebM_BaseMap_no_contour.vtpk";
var mapPackagePath = System.IO.Path.Combine(mapPackageFolder, mapPackageFile);
var tileCache = new VectorTileCache(mapPackagePath);
ArcGISVectorTiledLayer vectorTiledLayer = new ArcGISVectorTiledLayer(tileCache);
map = new Map(new Basemap(vectorTiledLayer));
// Create starting viewpoint
Viewpoint startingViewpoint = new Viewpoint(
-42.882317, 147.327125,
10000);
map.InitialViewpoint = startingViewpoint;
return map;