Memory leak updating graphic symbol - ArcGis Runtime .Net

2831
0
08-27-2015 03:13 AM
ErnestoLiria
New Contributor

i'm working with ArcGis Runtime SDK for .Net v10.2.5.

I have an UDP socket listening and waiting for image data that fires a function executed on a different thread in background.

I want to draw the image over a ellipse of arbitrary radius so i use

 var filestream = System.IO.File.Open(imagepath, FileMode.Open, FileAccess.Read);
 MapPoint point = new MapPoint(center.longitude, center.latitude, SpatialReferences.Wgs84);  
 var polySymbol = new Esri.ArcGISRuntime.Symbology.PictureFillSymbol(); 
 await polySymbol.SetSourceAsync(filestream);  
 var param = new GeodesicEllipseParameters(point, 25, LinearUnits.Meters); 
 var ellipse = GeometryEngine.GeodesicEllipse(param);  

 ***//HERE IS THE PROBLEM*** 
 _graphicsLayer.Graphics.Clear(); 
 _graphicsLayer.Graphics.Add(new Graphic { Geometry = ellipse, Symbol = polySymbol }); 

This is done ~5 times/second. Despite i'm clearing the layer each iteration there is a memory leak that is increasing memory use till app crashes.

I read about problems with memory using ArcGIS and Geometry process, so i'm not sure if i'm hitting a wall or just doing things badly

I also tried overwriting geometry without clear:

 //this is the problematic line, if i comment that, memory doesn't increase. _
 _graphicsLayer.Graphics[0].Symbol = polySymbol;  

 _graphicsLayer.Graphics[0].Geometry = ellipse; 

And using stream statement, filestream is properly closed at the end, but used RAM keep increasing till app crashes, each time i update geometry symbol memory use is increased without free previous resources.

0 Kudos
0 Replies