AnsweredAssumed Answered

Native memory leak in PictureMarkerSymbol.SetSourceAsync()?

Question asked by ahigh2 on Feb 24, 2016
Latest reply on Jul 18, 2018 by danbrandt

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();


            using (Stream stream = new MemoryStream())



                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.