Hello,
I've been using the ArcGIS Pro SDK to write an application which updates a Geodatabase.
It seems to be accumulating a lot of memory usage over time though, and it doesn't seem to be my own code which is accumulating, but rather heap memory.
I tried isolating the relavant parts into a smaller PoC for you to observe the issue yourselves.
Basically what this application does it:
- Creates well known binaries (Wkb) from Gml using NetTopologySuite
- Imports the Wkbs into ESRI Geometries using the GeometryEngine
- Creates a union of the geometries using the GeometryEngine
- Stores the Feature (with Geometry) in a Geodatabase
In the real application I get about 20GB of memory usage after storing about 4 million features in the Geodatabase.
I've used the application .NET Memory Profiler to try to look into what's using all the memory and it seems to be the Union-call which isn't getting cleaned up?
Looking at the heap I have alot of these for example:
ntdll!RtlAllocateHeap( HANDLE, DWORD, SIZE_T )
ucrtbase!_malloc_base()
pe!pe_xd_find_patt()
pe!pe_spheroid_ext_new_errext()
pe!pe_spheroid_clone()
pe!pe_datum_clone()
[Managed to native transition]
ArcGIS.Core!ArcGIS.Core.Internal.IGeometryEngineIOP.GEUnionArray( IntPtr[],SpatialReferenceTiny,string,string,ref bool )
ArcGIS.Core!ArcGIS.Core.Geometry.GeometryEngine.Union( IEnumerable<Geometry> )
SampleApp!BALSynchronizer_v2.Helpers.ArcGisHelper.ESRIGeometryFromWKBs( IEnumerable<Wkb> ) ArcGISHelper.cs Line 24
SampleApp!SampleApp.Program.InsertGdb( RowBuffer,Building ) SampleApp.cs Line 117
SampleApp!SampleApp.Program.StoreInGdb( string,List<Building> ) SampleApp.cs Line 135
SampleApp!SampleApp.Program.Main( string[] ) SampleApp.cs Line 187
I cant see any way to dispose the ESRI Geometries manually so I assume that they should be automatically disposed somehow?
Got any suggestions for me? 🙂
Have a great weekend!
/Lars