<?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: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA) in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403589#M10795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try to call &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gParcels.Search(gSF, False) (not-recycling cursor) instead. The ESRI documentation says that it's forbidden to keep a reference to a row retrieved from a recycling cursor (can't say where I've read this, but I did...). The recycling cursor might even be responsible for the memory leak, since it does not release all its ressources as the non-recycling cursor does.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jun 2010 08:17:14 GMT</pubDate>
    <dc:creator>JanDuske</dc:creator>
    <dc:date>2010-06-30T08:17:14Z</dc:date>
    <item>
      <title>IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403581#M10787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have this function that gets called many times in a loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Private Function FindParcelOfObject(feat As IFeature) As IFeature&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Static fcursor As IFeatureCursor&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set gSF.Geometry = feat.Shape 'gSF is ISpatialFilter declared at module level&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; gSF.SpatialRel = esriSpatialRelWithin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set fcursor = gParcels.Search(gSF, True) 'gParcels is IFeatureClass declared at module level&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set FindParcelOfObject = fcursor.NextFeature 'memory leak&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set fcursor = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End Function&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The line with NextFeature increases memory usage by about 6K each time it gets called. As the function is called many times, it exhausts memory very quickly. Is there something I do wrong here? Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 06:56:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403581#M10787</guid>
      <dc:creator>ManuelF_</dc:creator>
      <dc:date>2010-06-18T06:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403582#M10788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"jmr1973",&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rather than have your SpatialFilter (gSF) declared globally at module level try creating it and destroying it within the procedure itself?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 08:17:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403582#M10788</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2010-06-18T08:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403583#M10789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;"jmr1973",&lt;BR /&gt;&lt;BR /&gt;Rather than have your SpatialFilter (gSF) declared globally at module level try creating it and destroying it within the procedure itself?&lt;BR /&gt;&lt;BR /&gt;Duncan&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Duncan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, this does not solve my problem. NextFeature is still grabbing a piece of memory with each execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 09:40:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403583#M10789</guid>
      <dc:creator>ManuelF_</dc:creator>
      <dc:date>2010-06-18T09:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403584#M10790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried setting the feature to nothing after you are done with it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 19:32:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403584#M10790</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2010-06-18T19:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403585#M10791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The only other thing I can tell from your code is the use of the &lt;/SPAN&gt;&lt;STRONG&gt;Static&lt;/STRONG&gt;&lt;SPAN&gt; keyword for declaring your featurecursor. I've never used Static (mainly out of ignorance in what it does!) I would have used Dim and have never come across the issues you are having, so try swapping that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jun 2010 21:15:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403585#M10791</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2010-06-18T21:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403586#M10792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The only other thing I can tell from your code is the use of the &lt;STRONG&gt;Static&lt;/STRONG&gt; keyword for declaring your featurecursor. I've never used Static (mainly out of ignorance in what it does!) I would have used Dim and have never come across the issues you are having, so try swapping that?&lt;BR /&gt;&lt;BR /&gt;Duncan&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Static is there mainly so I don't have to declare a variable at module level as I already have too much of them. Since this function gets called about 10000 times i thought it would be more efficient to declare it like that than use Dim which would allocate memory each time it gets called. Anyway, I tried using Dim, same thing happens.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jun 2010 08:33:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403586#M10792</guid>
      <dc:creator>ManuelF_</dc:creator>
      <dc:date>2010-06-19T08:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403587#M10793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you tried setting the feature to nothing after you are done with it?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alexander, I'll have to get back to you Monday as I don't have access to ArcGIS at home... thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jun 2010 08:38:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403587#M10793</guid>
      <dc:creator>ManuelF_</dc:creator>
      <dc:date>2010-06-19T08:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403588#M10794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Alexander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I set feature to Nothing and it still does not return memory to system... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; Any other ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jun 2010 05:40:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403588#M10794</guid>
      <dc:creator>ManuelF_</dc:creator>
      <dc:date>2010-06-21T05:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403589#M10795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try to call &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gParcels.Search(gSF, False) (not-recycling cursor) instead. The ESRI documentation says that it's forbidden to keep a reference to a row retrieved from a recycling cursor (can't say where I've read this, but I did...). The recycling cursor might even be responsible for the memory leak, since it does not release all its ressources as the non-recycling cursor does.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jun 2010 08:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403589#M10795</guid>
      <dc:creator>JanDuske</dc:creator>
      <dc:date>2010-06-30T08:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: IFeatureCursor.NextFeature Leaks Memory (ArcGIS 9.2, VBA)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403590#M10796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you ever find solution to this,, I am also facing the such errors.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Sep 2010 11:04:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturecursor-nextfeature-leaks-memory-arcgis-9-2/m-p/403590#M10796</guid>
      <dc:creator>AnilDhiman</dc:creator>
      <dc:date>2010-09-08T11:04:07Z</dc:date>
    </item>
  </channel>
</rss>

