Hi Ben, we only have two projections, ESPG 4326 and 3857. Still working on a minimal example (everything is very tightly coupled and I have to remove all proprietary references).
Typically the map will be in the web mercator projection, but all the data is in decimal degrees/unprojected (normal lat lon coordinates ±180/±90.)
Ran another profiler, and it is showing the memory issue is in libSkiaSharp (look on right side of image)
In previous screenshots I posted, there was a byte array taking up a huge amount of memory. This might stem from the wellknownbinary array according to the profiler (or it’s some byte array in skiasharp, which the profiler can’t seen into)
To recap, this happens with a high refresh rate and when the window is bigger. If I lower the refresh speed and/or shrink the window, everything seems to “catch up” and the unmanaged memory usage will start to drop.
Something that may be related…what is the proper way to be updating the position of a single feature? In the samples project for the vehicle gps movement, you are simply clearing the internal features and adding another one before refreshing.
Here’s what is happening in our code:
var existingFeature = inMemoryFeatureLayer.FeatureSource.GetFeatureById(featureName, ReturningColumnsType.AllColumns);
var shape = (PointShape)existingFeature .GetShape();
shape.X = longitude; //set a new longitude
shape.Y = latitude; //set a new latitude
shape.Id = existingFeature.Id;
//Make a new feature based on the new shape location
var newFeature = new Feature(shape, existingFeature.ColumnValues);
// check if we are in mercator projection
if (currentProjection == mercatorProjection)
{
//Add an extra step with Mercator to convert to proper values
PointShape ps = (PointShape)feature.GetShape();
ps = (PointShape)MercatorProjConv.ConvertToInternalProjection(ps);
newFeature = new Feature(ps, existingFeature.ColumnValues);
}
inMemoryFeatureLayer.InternalFeatures[existingFeature.Id] = feature; //feature
From there, we either do a map.CenterAt(shape)
or a map.Refresh(map.CurrentExtent, someOverlay)
. It seems a bit convoluted, and it was written back when v10 libraries were the latest I believe. Maybe we shouldn’t be making a new feature based off of the existing one?