Good afternoon,
I've been trying to debug some private byte allocation leaks in my application and finally think I've narrowed it down to the PictureMarkerSymbol.SetSourceAsync() method.
My use case consists of updating n number of PictureMarkerSymbol sources/geometries on the map once every ~100ms. Through a combination of Redgate, WinDbg, and ultimately DebugDiag I pinpointed the culprit (I think) to RuntimeCoreNet calling into msvcr120::malloc.
I'm setting the source of my PictureMarkerSymbols like this:
private async void periodicUpdate()
{
BitmapFrame frame = BitmapFrame.Create(this.someBitmapSource);
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(frame);
using (Stream stream = new MemoryStream())
{
encoder.Save(stream);
stream.Seek(0, SeekOrigin.Begin);
await this.pictureSymbol.SetSourceAsync(stream);
}
}
Has anyone else encountered this issue? Am I setting the source incorrectly or otherwise missing something else? The leak seems to be pretty linear in growth and will generate an OutOfMemoryException fairly reliably.