<?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: Geoprocessing tool leaking memory in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115317#M3022</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you try to release the Geoprocessor object and call garbage collection afterwards? This should be done after calling a single geoprocessing tool to avoid strange affects regarding memory issues.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Apr 2011 13:18:35 GMT</pubDate>
    <dc:creator>StefanOffermann</dc:creator>
    <dc:date>2011-04-13T13:18:35Z</dc:date>
    <item>
      <title>Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115316#M3021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using the point solar radiation geoprocessing tool in a loop of around 100000 times. I have noticed that the virtual memory increases tremendously after each loop. Thus after a certain time the program crashes when the virtual memory gets its maximum limit.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem seems that the geoprocessing tool object is unable to release the resources once it goes out of scope. Please note that I have tried almost all possible options to destroy the object (geoprocessing tool) once it goes out of scope. For example, I have tried AOUninitialize.Shutdown()method, ComReleaser.ReleaseCOMObject () method, Marshal.ReleaseComObject() method, Garbage collector etc. but none of those could solve the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides, I have tried to execute the geoprocessing tool separately with managed and unmanaged assembly to observe any noticeable changes in the virtual memory consumption. But, unfortunately nothing good happened. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, I have tried to run the code specific for executing the point solar radiation tool in a separate subroutine so that in each loop the program jump in to that separate sub, execute the geoprocessing tool and exit the sub. The idea was, with the exit of sub, the system should release all the resources and allocated memory. But again it failed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;now my queries are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Is there any other way to solve this problem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Is this a serious bug still alive in the arcobjects&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. If it is a bug then how long the user have to wait for a solution.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Apr 2011 12:08:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115316#M3021</guid>
      <dc:creator>Md__ImranHossain</dc:creator>
      <dc:date>2011-04-13T12:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115317#M3022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you try to release the Geoprocessor object and call garbage collection afterwards? This should be done after calling a single geoprocessing tool to avoid strange affects regarding memory issues.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Apr 2011 13:18:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115317#M3022</guid>
      <dc:creator>StefanOffermann</dc:creator>
      <dc:date>2011-04-13T13:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115318#M3023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Stefan!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I tried. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;comReleaser.ReleaseCOMObject(GP)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GP = Nothing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GC.Collect()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GC.WaitForPendingFinalizers()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it did not work. Any other idea??&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Imran&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Apr 2011 13:42:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115318#M3023</guid>
      <dc:creator>Md__ImranHossain</dc:creator>
      <dc:date>2011-04-13T13:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115319#M3024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried using the ESRI.ArcGIS.ADF.ComReleaser? Here's an example of one of my geoprocessing subroutines. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Friend Sub DeleteObject(ByVal pInObject As Object)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Delete As New ESRI.ArcGIS.DataManagementTools.Delete
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using releaser As New ESRI.ArcGIS.ADF.ComReleaser
&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; releaser.ManageLifetime(Delete)
&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; Delete.in_data = pInObject

&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; Result = RunTool(Delete, Nothing)

&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; If Result Is Nothing Then
&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;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show("Could not delete object")
&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; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show(ex.ToString, "Delete error")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub

&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub ReturnMessages(ByVal pResult As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2, ByVal Title As String)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ErrorMessage As String

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If pResult.MessageCount &amp;gt; 0 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Count As Integer = 0 To pResult.MessageCount - 1
&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; ErrorMessage += pResult.GetMessage(Count)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show(ErrorMessage, Title)

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub

&amp;nbsp;&amp;nbsp;&amp;nbsp; Friend Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel2) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Result = CType(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Result.Status &amp;lt;&amp;gt; ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then ReturnMessages(Result, "Geoprocessing Error")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GP.ClearMessages()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReturnMessages(Result, "Fail")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show(ex.ToString, "Run Geoprocessor")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return Result

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:48:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115319#M3024</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T06:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115320#M3025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello kenbuja!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your attention!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have applied your geoprocessing sub but still no luck, sorry to say.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using point solar radiation tool and perhaps this particular geoprocessing tool has some bugs (Just a wild guess). I would highly appreciate if you have any other idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would also like to take attention from ESRI guys in this regards.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Imran&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2011 08:20:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115320#M3025</guid>
      <dc:creator>Md__ImranHossain</dc:creator>
      <dc:date>2011-04-14T08:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115321#M3026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you indicate how large of an area you are processing?&amp;nbsp; Generally speaking the tool is not recommended if the size of the area being analyzed is larger that one degree of latitude.&amp;nbsp; In the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z000000t6000000.htm"&gt;help&lt;/A&gt;&lt;SPAN&gt;, there are other recommendations including the sky size, coordinate system and output options. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In terms of the memory issue, the tool is very memory intensive and successive runs will create problems.&amp;nbsp; Have you considered using spawnV? Here are some &lt;/SPAN&gt;&lt;A href="http://forums.esri.com/Thread.asp?c=93&amp;amp;f=1729&amp;amp;t=173610&amp;amp;mc=33#512760"&gt;forum posts&lt;/A&gt;&lt;SPAN&gt; that indicate some success with deleting the geoprocessor that way for intensive runs.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There are also more tips &lt;/SPAN&gt;&lt;A href="http://forums.esri.com/thread.asp?c=93&amp;amp;f=995&amp;amp;t=221277"&gt;here&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2011 12:54:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115321#M3026</guid>
      <dc:creator>JeffreySwain</dc:creator>
      <dc:date>2011-05-12T12:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115322#M3027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Jeff!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot for your attention!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, the area is only 50x50 meter means it is small enough to run the tool. The other parameters like sky size, coordinate system, zenith and azimuth division etc. were kept as default. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As regards using spawnV, please note that I am using VB.NET as the language and I have tried all possible options to destroy the GP once it goes out of scope. But it did not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Imran&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 May 2011 09:13:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115322#M3027</guid>
      <dc:creator>Md__ImranHossain</dc:creator>
      <dc:date>2011-05-16T09:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool leaking memory</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115323#M3028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What version are you using? If you are using ArcGIS 10.0 I'm curious to know if &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Running_a_geoprocessing_tool_using_background_geoprocessing/00010000015z000000/"&gt;running the tool in the background&lt;/A&gt;&lt;SPAN&gt; would allow you to avoid this.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 22:57:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/geoprocessing-tool-leaking-memory/m-p/115323#M3028</guid>
      <dc:creator>JohnHauck</dc:creator>
      <dc:date>2011-05-17T22:57:41Z</dc:date>
    </item>
  </channel>
</rss>

