<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Possible memory leak in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029214#M6229</link>
    <description>&lt;P&gt;yes. after doing a Union with NTS and exporting it to Wkb, importing the Wkb into an ESRI geometry and doing insert/update no memory leakage appears to be occurring anymore, so seems to be related to doing a Union with the ArcGIS Pro SDK&lt;/P&gt;</description>
    <pubDate>Mon, 22 Feb 2021 17:55:41 GMT</pubDate>
    <dc:creator>LarsDomesjö</dc:creator>
    <dc:date>2021-02-22T17:55:41Z</dc:date>
    <item>
      <title>Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1028461#M6210</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've been using the ArcGIS Pro SDK to write an application which updates a Geodatabase.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I tried isolating the relavant parts into a smaller PoC for you to observe the issue yourselves.&lt;/P&gt;&lt;P&gt;Basically what this application does it:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Creates well known binaries (Wkb) from Gml using NetTopologySuite&lt;/LI&gt;&lt;LI&gt;Imports the Wkbs into ESRI Geometries using the GeometryEngine&lt;/LI&gt;&lt;LI&gt;Creates a union of the geometries using the GeometryEngine&lt;/LI&gt;&lt;LI&gt;Stores the Feature (with Geometry) in a Geodatabase&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the real application I get about 20GB of memory usage after storing about 4 million features in the Geodatabase.&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;Looking at the heap I have alot of these for example:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;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&amp;lt;Geometry&amp;gt; )
SampleApp!BALSynchronizer_v2.Helpers.ArcGisHelper.ESRIGeometryFromWKBs( IEnumerable&amp;lt;Wkb&amp;gt; ) ArcGISHelper.cs Line 24
SampleApp!SampleApp.Program.InsertGdb( RowBuffer,Building ) SampleApp.cs Line 117
SampleApp!SampleApp.Program.StoreInGdb( string,List&amp;lt;Building&amp;gt; ) SampleApp.cs Line 135
SampleApp!SampleApp.Program.Main( string[] ) SampleApp.cs Line 187&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cant see any way to dispose the ESRI Geometries manually so I assume that they should be automatically disposed somehow?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Got any suggestions for me? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a great weekend!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Lars&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 13:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1028461#M6210</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2021-02-19T13:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1028716#M6213</link>
      <description>&lt;P&gt;If you comment out (or remove) the code where you're writing/updating geodatabase, do you still get a leak?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 20:32:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1028716#M6213</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-02-19T20:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1028729#M6214</link>
      <description>&lt;P&gt;Did you try doing the union with NTS instead of Esri?&lt;/P&gt;&lt;P&gt;&lt;A href="https://nettopologysuite.github.io/NetTopologySuite/api/NetTopologySuite.Operation.Union.UnaryUnionOp.html" target="_blank"&gt;https://nettopologysuite.github.io/NetTopologySuite/api/NetTopologySuite.Operation.Union.UnaryUnionOp.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 21:02:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1028729#M6214</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-02-19T21:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029018#M6220</link>
      <description>&lt;P&gt;I did try this and I am not getting a memory leak if I remove the parts writing/updating the database&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 08:36:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029018#M6220</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2021-02-22T08:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029019#M6221</link>
      <description>&lt;P&gt;That's a good suggestion, I will try this and see if it resolves my issue, just did a quick try and I seem to be getting faulty polygons when using NTS Union, will need some more investigation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 08:37:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029019#M6221</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2021-02-22T08:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029044#M6223</link>
      <description>&lt;P&gt;Seems like NTS-Union is causing some Z-values with NaN for some polygons for some reason.&lt;/P&gt;&lt;P&gt;Created an ugly SequenceFilter for NTS which updates all Z-values with "0.001" just for testing purposes and can confirm that the memory leak is not there when doing the Union with NTS instead of the ArcGIS Pro SDK, so the leak seems to be somewhere in the Union-call in the ArcGIS Pro SDK.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 11:30:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029044#M6223</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2021-02-22T11:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029100#M6224</link>
      <description>&lt;P&gt;After calling NTS Union, are you able to insert/update without leaking memory?&lt;/P&gt;&lt;P&gt;If so, I suppose Esri's GeometryEngine hangs onto a reference to the unioned geometry in such a way that it doesn't get released after the insert/update.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 14:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029100#M6224</guid>
      <dc:creator>KirkKuykendall1</dc:creator>
      <dc:date>2021-02-22T14:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Possible memory leak</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029214#M6229</link>
      <description>&lt;P&gt;yes. after doing a Union with NTS and exporting it to Wkb, importing the Wkb into an ESRI geometry and doing insert/update no memory leakage appears to be occurring anymore, so seems to be related to doing a Union with the ArcGIS Pro SDK&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 17:55:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/possible-memory-leak/m-p/1029214#M6229</guid>
      <dc:creator>LarsDomesjö</dc:creator>
      <dc:date>2021-02-22T17:55:41Z</dc:date>
    </item>
  </channel>
</rss>

