<?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: Memory issue inserting a large dataset in GDB with ArcObjects in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511645#M13806</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not program in java so not sure if this is even an option for you. There is an interface called &lt;EM&gt;IFeatureClassLoad&lt;/EM&gt; which alters the behaviour of the Feature class when doing bulk loads, have a look at that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 May 2015 09:22:54 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2015-05-08T09:22:54Z</dc:date>
    <item>
      <title>Memory issue inserting a large dataset in GDB with ArcObjects</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511644#M13805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;I am using the ArcObjects API for Java to load a very large dataset in a File Geodatabase in one feature class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;The whole dataset I have to load is composed of 200 datasets of 30k polygons, and I load the datasets one after the other. I read data from XML files (I am sure there is no memory leak in this step).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;The loading process is in a BaseGeoprocessingTool.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;Here is my code to write the data of one dataset in the feature class:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt; IFeatureClass featureClass = ...&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureCursor insertCursor = featureClass.IFeatureClass_insert(false); // true uses too much memory&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeatureBuffer featureBuffer = featureClass.createFeatureBuffer();&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeometry geometry = null;&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;Integer&amp;gt; fieldIdsToClear = new ArrayList&amp;lt;Integer&amp;gt;();&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int i = 0;&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(FeatureBean featureBean : features) {&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(log.canContinue()) {&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometry = featureBean.geometry.getGeometry();&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geometry.setSpatialReferenceByRef(fromSpatialReference);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(toBeProjected) geometry.project(toSpatialReference);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureBuffer.setShapeByRef(geometry);&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // reset the fields in the featureBuffer&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(Integer fieldId : fieldIdsToClear) {&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureBuffer.setValue(fieldId, null);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldIdsToClear.clear();&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureBuffer.setValue(idFieldId, (int)featureBean.id);&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(Entry&amp;lt;String, String&amp;gt; tag : featureBean.tagMap.entrySet()) {&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int fieldId = fieldIdMap.get(tag.getKey());&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureBuffer.setValue(fieldId, tag.getValue());&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldIdsToClear.add(fieldId);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertCursor.insertFeature(featureBuffer);&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i &amp;gt; 1000) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertCursor.flush();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; insertCursor.flush();&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cleaner.release(geometry);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cleaner.release(featureBuffer);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cleaner.release(insertCursor);&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cleaner.release(featureClass);&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;&lt;SPAN style="line-height: 1.5;"&gt;After reading these &lt;/SPAN&gt;&lt;A href="http://gis.stackexchange.com/questions/8186/performance-of-arcgisscripting-and-large-spatial-data-sets/9060#9060" style="line-height: 1.5; color: #358daa;" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;SPAN style="color: #303030;"&gt;advices&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="line-height: 1.5;"&gt;, I use an insert cursor instead of &lt;/SPAN&gt;&lt;CODE&gt;IFeature.store()&lt;/CODE&gt;&lt;SPAN style="line-height: 1.5;"&gt; so that process is ~5x faster. So, I do not recreate the FeatureBuffer each time I insert a new feature. Instead of, I reuse it and clear the necessary fields.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;This process works well and is very fast. Nevertheless, there is a memory leak. Watching &lt;CODE&gt;ArcMap.exe&lt;/CODE&gt;process memory, we can see that it uses about 100 Mb to load each dataset, then the memory is not released, even if objects are released in my code. When memory is about 1300 Mb (only after loaded the 5th dataset), the process crashes on the exception &lt;CODE&gt;AutomationException: One or more arguments are invalid&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;I have tried different Java max heap sizes with &lt;CODE&gt;JavaConfigTool.exe&lt;/CODE&gt; between 512 and 1900 Mb, but it doesn't change anything.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;What solution could I try to be sure that ArcGIS really release useless objects? As I have a lot of datasets to load, I really need to release to get back the 100 Mb each time a dataset has been loaded.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;I also tried to flush every 1, 1000 or 2000 features but it doesn't change anything in memory usage.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;Any help is welcome to optimize my process.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 1em; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #303030;"&gt;I use ArcGIS 10.2 with Background Geoprocessing (64bits) and have 8 Go of RAM.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:23:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511644#M13805</guid>
      <dc:creator>KevinLECOCQ</dc:creator>
      <dc:date>2021-12-11T22:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Memory issue inserting a large dataset in GDB with ArcObjects</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511645#M13806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do not program in java so not sure if this is even an option for you. There is an interface called &lt;EM&gt;IFeatureClassLoad&lt;/EM&gt; which alters the behaviour of the Feature class when doing bulk loads, have a look at that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2015 09:22:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511645#M13806</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2015-05-08T09:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Memory issue inserting a large dataset in GDB with ArcObjects</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511646#M13807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I tried this interface but I don't know why, when I cast my feature class to IFeatureClassLoad, I get a cast exception : java.lang.ClassCastException: com.esri.arcgis.geodatabase.IFeatureClassProxy cannot be cast to com.esri.arcgis.geodatabase.IFeatureClassLoad&lt;/P&gt;&lt;P&gt;However, according to the documentation, IFeatureClassLoad is implemented for File GDB feature classes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2015 15:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/memory-issue-inserting-a-large-dataset-in-gdb-with/m-p/511646#M13807</guid>
      <dc:creator>KevinLECOCQ</dc:creator>
      <dc:date>2015-05-18T15:56:02Z</dc:date>
    </item>
  </channel>
</rss>

