<?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: Processing cursor is taking long time in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4467#M114</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ArcObjects is 32 bits, are you running this inside an ArcGIS server SOC?&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No , I am not running inside SOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am just running it inside a window service application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, it is similar to running any command line application, but it is 64, and binding to the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is that a valid configuration?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These are the requirements of the client, and I had to go with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is already coming from 9.3 code, that was running as 32 bit and running under Engine license.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The client asked to converted to run with 10.1, and run on Arcgis server , and bind to server license (so it has to be 64 bit).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Mar 2013 17:57:43 GMT</pubDate>
    <dc:creator>GhassanKarwchan</dc:creator>
    <dc:date>2013-03-11T17:57:43Z</dc:date>
    <item>
      <title>Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4464#M111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am maintaining a code on arcobjects 10.1, and there is a bug happening.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a code that is parsing through a cursor, and generate a where clause statement to run it on a second query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So the code is like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

IFeatureCursor containsCursor = null;
IFeatureClass featureClass = null;
ISpatialFilter spatialFilter = new SpatialFilterClass();
IFeature tempFeature = null;

try
 {
&amp;nbsp; featureClass = workspace.OpenFeatureClass("tablename");
&amp;nbsp; spatialFilter.Geometry = operationalUnit.Shape;
&amp;nbsp; spatialFilter.GeometryField = featureClass.ShapeFieldName;
&amp;nbsp; spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

&amp;nbsp; containsCursor = featureClass.Search(spatialFilter, true);
&amp;nbsp; tempFeature = containsCursor.NextFeature();
&amp;nbsp; String whereClause = null;
&amp;nbsp; String fieldName = tempFeature.Table.OIDFieldName;
&amp;nbsp; while (tempFeature != null)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; if (tempFeature.HasOID)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; whereClause = whereClause + String.Format(" and {0} &amp;lt;&amp;gt; {1}", tempFeature.Table.OIDFieldName, tempFeature.OID);
&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp; tempFeature = containsCursor.NextFeature();
&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;&amp;nbsp; 

&amp;nbsp; (do something with the where clause)
 }
 finally
 {
&amp;nbsp; Helper.ReleaseObject(featureClass);
&amp;nbsp; Helper.ReleaseObject(tempFeature);
&amp;nbsp; Helper.ReleaseObject(containsCursor);
&amp;nbsp; Helper.ReleaseObject(spatialFilter);
 }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The loop that is generating the where clause is talking long time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and when it is done, it tries to connect to the database, and the connection is dead.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, the funny thing is the slowness in only on the Dev server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run it on my machine is fast.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my full details information&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On my Dev server: It is a virtual machine, with Windows 2008R2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I run ArcGIS serer 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I run the process binding to the Server, and to the server license.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I compile the process to run as 64 bit in order to bind to the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I access the database through Application Server SDE 9.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P.S: I don't use direct connection (and we are not going to change the code to use it)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I measured the length of the statement, and on the server for 3500 records is taking &amp;gt; 45 seconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On my machine: my machine is Windows 7 with 8 gig Ram.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I run ArcGIS Desktop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I compile the code to x86, and run binding to the desktop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the same amount of records it is taking &amp;lt; 4 seconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is wrong there?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 16:27:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4464#M111</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-03-09T16:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4465#M112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Server and Workstation modes of the Garbage Collector algorithm are slightly different, which may account for some or all of the differences between your development machine and the server machine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb680014.aspx" rel="nofollow noopener noreferrer" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/bb680014.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One thing I see that will speed things up is to use the StringBuilder class to accumulate strings for your where clause. &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.dotnetperls.com/stringbuilder" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.dotnetperls.com/stringbuilder&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, you're not releasing things within the loop, so a lot of unmanaged memory is being held onto longer than necessary. I put comments in these places for your consideration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IFeatureCursor containsCursor = null;
IFeatureClass featureClass = null;
ISpatialFilter spatialFilter = new SpatialFilterClass();
IFeature tempFeature = null;

try
{
 featureClass = workspace.OpenFeatureClass("tablename");
 spatialFilter.Geometry = operationalUnit.Shape;
 spatialFilter.GeometryField = featureClass.ShapeFieldName;
 spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

 containsCursor = featureClass.Search(spatialFilter, true);
 tempFeature = containsCursor.NextFeature();

 StringBuilder whereClauseBuilder = new StringBuilder();
 String fieldName = tempFeature.Table.OIDFieldName;;
 
 while (tempFeature != null)
 {
&amp;nbsp; if (tempFeature.HasOID)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; // put tempFeature.Table in a variable and release here so that you release each instance in the loop
&amp;nbsp;&amp;nbsp; whereClauseBuilder.Append( String.Format(" and {0} &amp;lt;&amp;gt; {1}", tempFeature.Table.OIDFieldName, tempFeature.OID ));
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; // release 'tempFeature' here so that you release each instance in the loop
&amp;nbsp; tempFeature = containsCursor.NextFeature();
 }&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; 

 String whereClause = whereClauseBuilder.ToString();
 // do something with the where clause
}
finally
{
 Helper.ReleaseObject(featureClass);
 Helper.ReleaseObject(tempFeature);
 Helper.ReleaseObject(containsCursor);
 Helper.ReleaseObject(spatialFilter);
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:10:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4465#M112</guid>
      <dc:creator>JasonPike</dc:creator>
      <dc:date>2021-12-10T20:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4466#M113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I compile the process to run as 64 bit in order to bind to the server.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcObjects is 32 bits, are you running this inside an ArcGIS server SOC?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason has good points but I don't see them accounting for that much difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would actually build a list of strings, at the end use the toArray in a string.joing with "and" and a separator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/57a79xd0.aspx"&gt;http://msdn.microsoft.com/en-us/library/57a79xd0.aspx&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Avoids having to deal with trailing or leading "and"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Check how long it takes to get the first feature, that is usually when the query is executed on the database side.&amp;nbsp; The creation of the cursor usually just validates the query but doesn't perform it.&amp;nbsp; If the return of the first feature is slow, then it is slow on the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is hard to say what is the best way without knowing what you plan on doing with it.&amp;nbsp; The whereclause looks like you are building a way to exclude these features from something else.&amp;nbsp; I am not sure you need to make this query in the first place, there are limits to length of the where clauses you can pass in the query filter.&amp;nbsp; If you absolutely need a cursor, you can limit the fields in the first spatial filter (Shape and ObjectID.) However, if you make a selection instead, the selection is an array of objectids (ISelectionSet.IDs.)&amp;nbsp; You can use this array to make your query filter for the table, or better yet create a selection on the table and use removeList from the selectionset and the you can call search on the selectionset and get a cursor off of the selection.&amp;nbsp; ISelectionSet2 even lets you get an update cursor off of the selectionset.&amp;nbsp; You can pass in additional conditions in those cursors.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 17:40:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4466#M113</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-03-11T17:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4467#M114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ArcObjects is 32 bits, are you running this inside an ArcGIS server SOC?&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No , I am not running inside SOC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am just running it inside a window service application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, it is similar to running any command line application, but it is 64, and binding to the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is that a valid configuration?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These are the requirements of the client, and I had to go with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code is already coming from 9.3 code, that was running as 32 bit and running under Engine license.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The client asked to converted to run with 10.1, and run on Arcgis server , and bind to server license (so it has to be 64 bit).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 17:57:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4467#M114</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-03-11T17:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4468#M115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;ArcObjects is 32 bits, are you running this inside an ArcGIS server SOC?&lt;BR /&gt;&lt;BR /&gt;Check how long it takes to get the first feature, that is usually when the query is executed on the database side.&amp;nbsp; The creation of the cursor usually just validates the query but doesn't perform it.&amp;nbsp; If the return of the first feature is slow, then it is slow on the database.&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It takes only part of a second to run the query and get the first feature.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I put log inside the where clause, and actually to go through 3 thousands records was taking sometimes 3 minutes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It was processing less than 10 per second.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That on 64 bit, binding to the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But when I run it on 32 bit, the whole 3000 takes less than 5 seconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and again that time is during processing the loop, so it is after getting the first feature(which is running the query).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 18:25:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4468#M115</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-03-11T18:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4469#M116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Server and Workstation modes of the Garbage Collector algorithm are slightly different, which may account for some or all of the differences between your development machine and the server machine.&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb680014.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb680014.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Those are very valid points.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks ScJPike&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will try them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As for the string builder, I already did that, and didn't help so much.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 18:27:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4469#M116</guid>
      <dc:creator>GhassanKarwchan</dc:creator>
      <dc:date>2013-03-11T18:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4470#M117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Those are very valid points.&lt;BR /&gt;Thanks ScJPike&lt;BR /&gt;&lt;BR /&gt;I will try them.&lt;BR /&gt;As for the string builder, I already did that, and didn't help so much.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No problem. I'm really disappointed that StringBuilder didn't buy you much. I'd like to take one more crack at it. The implementation I suggest below makes some assumptions (like the OID field name and Table being the same), but if those assumptions are OK, it should save you a great deal in garbage collections.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IFeatureCursor containsCursor = null;
IFeatureClass featureClass = null;
ISpatialFilter spatialFilter = new SpatialFilterClass();
IFeature tempFeature = null;
ITable table = null;

try
{
 featureClass = workspace.OpenFeatureClass("tablename");
 spatialFilter.Geometry = operationalUnit.Shape;
 spatialFilter.GeometryField = featureClass.ShapeFieldName;
 spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;

 containsCursor = featureClass.Search(spatialFilter, true);
 tempFeature = containsCursor.NextFeature();
 table = tempFeature.Table;
 String fieldName = table.OIDFieldName;
 String andOIDFieldNotEqual = " and " + fieldName + " &amp;lt;&amp;gt; ";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringBuilder whereClauseBuilder = new StringBuilder();

 while (tempFeature != null)
 {
&amp;nbsp; if (tempFeature.HasOID)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; whereClauseBuilder.Append(andOIDFieldNotEqual);
&amp;nbsp;&amp;nbsp; whereClauseBuilder.Append(tempFeature.OID);
&amp;nbsp; }

&amp;nbsp; Helper.ReleaseObject(tempFeature);
&amp;nbsp; tempFeature = containsCursor.NextFeature();
 }&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; 

 String whereClause = whereClauseBuilder.ToString();
 (do something with the where clause)
}
finally
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Helper.ReleaseObject(table);
 Helper.ReleaseObject(featureClass);
 Helper.ReleaseObject(tempFeature);
 Helper.ReleaseObject(containsCursor);
 Helper.ReleaseObject(spatialFilter);
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:10:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4470#M117</guid>
      <dc:creator>JasonPike</dc:creator>
      <dc:date>2021-12-10T20:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4471#M118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Releasing a reference to tempFeature inside the while loop?&amp;nbsp; How would the while loop continue?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Mar 2013 19:23:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4471#M118</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2013-03-11T19:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4472#M119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Releasing a reference to tempFeature inside the while loop?&amp;nbsp; How would the while loop continue?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Good catch, Leo. I got in a hurry and pasted the release after the assignment of the next feature instead of before it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I intended, which was to release the previously used feature before assigning the new one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Helper.ReleaseObject(tempFeature);
tempFeature = containsCursor.NextFeature();&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll fix the original as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4472#M119</guid>
      <dc:creator>JasonPike</dc:creator>
      <dc:date>2021-12-10T20:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Processing cursor is taking long time</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4473#M120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great solution and works fine for me. I have an Console Application using ArcObjects SDK 10.3.1 thats run in a Windows 64bits Server and didn´t work after some loops, for example, it reads 20 features and did not anything more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Fabio&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jun 2016 12:58:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/processing-cursor-is-taking-long-time/m-p/4473#M120</guid>
      <dc:creator>FabioPiona_de_Sousa</dc:creator>
      <dc:date>2016-06-06T12:58:09Z</dc:date>
    </item>
  </channel>
</rss>

