<?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: python geocoder api memory leak in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-geocoder-api-memory-leak/m-p/764145#M478</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was using python v3.7&lt;/P&gt;&lt;P&gt;Using python&amp;nbsp;&lt;SPAN style="font-size: 12.0pt;"&gt;v3.6.8 works fine &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Nov 2019 16:52:29 GMT</pubDate>
    <dc:creator>Jean-BernardGariépy</dc:creator>
    <dc:date>2019-11-26T16:52:29Z</dc:date>
    <item>
      <title>python geocoder api memory leak</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-geocoder-api-memory-leak/m-p/764144#M477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I'm batch geocoding millions of adresses using our dedicated Enterprise ArcGIS Server.&lt;/P&gt;&lt;P&gt;Some of the batch geocoding results end up being pretty bad, so we geocode them again one by one using the same geocoding service... and usually get much better results than batch geocoding (but that's a whole different issue).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This sample code is just to prove the point.&lt;/P&gt;&lt;P&gt;Every single call to the geocode() function make my python process add an extra 3MB of RAM. Eventually it reaches&amp;nbsp;40GIG+ of RAM. That is not suitable for a production environment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But sys.getsizeof(geocode) doesn't change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any clue?&lt;/P&gt;&lt;P&gt;I've implemented 2 different ways and both do the same.&lt;/P&gt;&lt;P&gt;By the way, the batch geocoder also have a memory leak, but much smaller.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;arcgis.geocoding&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;geocode&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;arcgis.gis&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;GIS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;import&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;sys&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;gis&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;GIS(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'https://our_server/portal'&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;True&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;single_result&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;geocode(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;'3623&amp;nbsp;Rue&amp;nbsp;Saint-Denis,&amp;nbsp;Montréal,&amp;nbsp;QC&amp;nbsp;H2X&amp;nbsp;3L6'&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(sys.getsizeof(geocode))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;from&amp;nbsp;arcgis.gis&amp;nbsp;import&amp;nbsp;GIS&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;from&amp;nbsp;arcgis.geocoding&amp;nbsp;import&amp;nbsp;Geocoder,&amp;nbsp;get_geocoders,&amp;nbsp;geocode&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;from&amp;nbsp;time&amp;nbsp;import&amp;nbsp;time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;import&amp;nbsp;datetime&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;import&amp;nbsp;sys&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;geocoderlist&amp;nbsp;=&amp;nbsp;get_geocoders(GIS())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;geocoder&amp;nbsp;=&amp;nbsp;Geocoder(geocoderlist[0].url)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;#geocoderlist&amp;nbsp;=&amp;nbsp;get_geocoders(GIS('https://&lt;SPAN style="color: #ce9178; background-color: #1e1e1e;"&gt;our_server&lt;/SPAN&gt;/portal'))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;#geocoder&amp;nbsp;=&amp;nbsp;Geocoder(geocoderlist[0].url)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;while&amp;nbsp;True:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;single_result&amp;nbsp;=&amp;nbsp;geocoder._geocode('3623&amp;nbsp;Rue&amp;nbsp;Saint-Denis,&amp;nbsp;Montréal,&amp;nbsp;QC&amp;nbsp;H2X&amp;nbsp;3L6')[0]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(sys.getsizeof(geocoder))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Nov 2019 16:45:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-geocoder-api-memory-leak/m-p/764144#M477</guid>
      <dc:creator>Jean-BernardGariépy</dc:creator>
      <dc:date>2019-11-25T16:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: python geocoder api memory leak</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-geocoder-api-memory-leak/m-p/764145#M478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was using python v3.7&lt;/P&gt;&lt;P&gt;Using python&amp;nbsp;&lt;SPAN style="font-size: 12.0pt;"&gt;v3.6.8 works fine &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Nov 2019 16:52:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-geocoder-api-memory-leak/m-p/764145#M478</guid>
      <dc:creator>Jean-BernardGariépy</dc:creator>
      <dc:date>2019-11-26T16:52:29Z</dc:date>
    </item>
  </channel>
</rss>

