<?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: release com objects? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548133#M14824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;.NET automatically releases objects when they are no longer used.&amp;nbsp; This is called Garbage Collection (GC).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One issue with this is that the mechanism has to have some sense of pressure, i.e. how much does a given object cost.&amp;nbsp; When everything is pure .NET it works great.&amp;nbsp; When you throw COM interop into the mix it works less well.&amp;nbsp; Essentially you have a small .NET object referencing a COM object in a black box, i.e. the system has no sense of pressure.&amp;nbsp; This creates a pain point that Microsoft did not design the automated machine to handle well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cursors are particularily sensitive.&amp;nbsp; If you are ripping through these (and they are private) then you need to be explicitly releasing them.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 19 May 2012 10:39:03 GMT</pubDate>
    <dc:creator>RichardWatson</dc:creator>
    <dc:date>2012-05-19T10:39:03Z</dc:date>
    <item>
      <title>release com objects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548130#M14821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I have developed a tool in arc-objects on Visual studio 2010,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the tool works fine but once installed my Arc Map drawing the map(refreshing) and printing slows down..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have used ITopologicalOperator in the program&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should I release any com objects here if yes what object should I release&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please guide&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 12:54:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548130#M14821</guid>
      <dc:creator>SantoshV</dc:creator>
      <dc:date>2012-05-16T12:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: release com objects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548131#M14822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Santosh,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Without seeing your code its hard to know why it should slow down.&amp;nbsp; I know it's good practise to release cursors. Below is some example code on how I release a cursor, but your slowing down may be nothing to do with memory consumption it could be poor logic like creating the same object every time in a loop when it needs only to be created once (e.g. a spatialfilter object)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color:#008000;"&gt;' For ArcGIS 10 using VS 2010 you need to import the following
&lt;/SPAN&gt;Imports ESRI.ArcGIS.ADF.Connection.Local
Imports ESRI.ArcGIS.ADF
 
&lt;SPAN style="color:#000080;"&gt;Dim&lt;/SPAN&gt; pQueryFilter &lt;SPAN style="color:#000080;"&gt;As&lt;/SPAN&gt; IQueryFilter 
pQueryFilter= &lt;SPAN style="color:#000080;"&gt;New&lt;/SPAN&gt; QueryFilterClass
pQueryFilter.WhereClause = &lt;SPAN style="color:#800000;"&gt;"ID = 1"&lt;/SPAN&gt;
Using releaser &lt;SPAN style="color:#000080;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color:#000080;"&gt;New&lt;/SPAN&gt; ComReleaser
 &lt;SPAN style="color:#000080;"&gt;Dim&lt;/SPAN&gt; pFeatureCursor &lt;SPAN style="color:#000080;"&gt;As&lt;/SPAN&gt; IFeatureCursor
 pFeatureCursor = pFeatureclass.Update(pQueryFilter, &lt;SPAN style="color:#000080;"&gt;True&lt;/SPAN&gt;)
 releaser.ManageLifetime(pFeatureCursor)
 &lt;SPAN style="color:#000080;"&gt;Dim&lt;/SPAN&gt; pFeature &lt;SPAN style="color:#000080;"&gt;As&lt;/SPAN&gt; IFeature 
 pFeature = pFeatureCursor.NextFeature
 &lt;SPAN style="color:#000080;"&gt;While&lt;/SPAN&gt; pFeature IsNot &lt;SPAN style="color:#000080;"&gt;Nothing&lt;/SPAN&gt;
 &lt;SPAN style="color:#008000;"&gt;' Do something with pFeature
&lt;/SPAN&gt; pFeatureCursor.UpdateFeature(pFeature)
 pFeature = pFeatureCursor.NextFeature
 &lt;SPAN style="color:#000080;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color:#000080;"&gt;While&lt;/SPAN&gt;
&lt;SPAN style="color:#000080;"&gt;End&lt;/SPAN&gt; Using
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548131#M14822</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T23:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: release com objects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548132#M14823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For the most part you shouldn't have to. ESRI objects will generally selfdestruct nicely when the function/scope gets closed. I would check the logic and make sure the process ITopologicalOperator is performing, is working only when wanted.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 21:19:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548132#M14823</guid>
      <dc:creator>BennettChamberland</dc:creator>
      <dc:date>2012-05-16T21:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: release com objects?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548133#M14824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;.NET automatically releases objects when they are no longer used.&amp;nbsp; This is called Garbage Collection (GC).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One issue with this is that the mechanism has to have some sense of pressure, i.e. how much does a given object cost.&amp;nbsp; When everything is pure .NET it works great.&amp;nbsp; When you throw COM interop into the mix it works less well.&amp;nbsp; Essentially you have a small .NET object referencing a COM object in a black box, i.e. the system has no sense of pressure.&amp;nbsp; This creates a pain point that Microsoft did not design the automated machine to handle well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cursors are particularily sensitive.&amp;nbsp; If you are ripping through these (and they are private) then you need to be explicitly releasing them.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 May 2012 10:39:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/release-com-objects/m-p/548133#M14824</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2012-05-19T10:39:03Z</dc:date>
    </item>
  </channel>
</rss>

