<?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 Need to dispose a Geodatabase always? in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/need-to-dispose-a-geodatabase-always/m-p/112#M4</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="https://developers.arcgis.com/android/10-2/api-reference/reference/com/esri/core/geodatabase/Geodatabase.html#dispose()" rel="nofollow noopener noreferrer" target="_blank"&gt;documentation&lt;/A&gt; states that :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;EM&gt;"public void dispose () --&amp;nbsp;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 13px;"&gt;Disposes the geodatabase. This method must be called when closing an application (or when otherwise finished with the geodatabase) to release resources which use the Geodatabase class."&lt;/SPAN&gt;&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;EM style="background-color: #ffffff; color: #333333; font-size: 13px;"&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;So do you always need to dispose a temporary geodatabase created for some reason within the app? &amp;nbsp;Would there be issues if I did not dispose the tempGDB at all? &amp;nbsp;What about if I only disposed the tempGDB on the final &amp;nbsp;tempGDB, ignoring the ones created during the loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a memory leak if the geodatabase is never disposed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 13px;"&gt;Ex:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;private void &lt;/SPAN&gt;&lt;SPAN style="color: #ffc66d;"&gt;someFunciton&lt;/SPAN&gt;(){
&amp;nbsp;&amp;nbsp; Geodatabase tempGDB&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp; for &lt;/SPAN&gt;(String gdbPath: &lt;SPAN style="color: #9876aa;"&gt;gdbArray&lt;/SPAN&gt;) {&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;//gdbArray is just an array of strings that contains paths to GDB's
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;try &lt;/SPAN&gt;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempGDB = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Geodatabase(gdbPath)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;//does something with tempGDB
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...finds all layers...etc.
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;tempGDB.dispose()&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;SPAN style="color: #cc7832;"&gt;catch&lt;/SPAN&gt;(Exception e){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 19:55:38 GMT</pubDate>
    <dc:creator>ForrestKaye</dc:creator>
    <dc:date>2021-12-10T19:55:38Z</dc:date>
    <item>
      <title>Need to dispose a Geodatabase always?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/need-to-dispose-a-geodatabase-always/m-p/112#M4</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The &lt;A href="https://developers.arcgis.com/android/10-2/api-reference/reference/com/esri/core/geodatabase/Geodatabase.html#dispose()" rel="nofollow noopener noreferrer" target="_blank"&gt;documentation&lt;/A&gt; states that :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;EM&gt;"public void dispose () --&amp;nbsp;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 13px;"&gt;Disposes the geodatabase. This method must be called when closing an application (or when otherwise finished with the geodatabase) to release resources which use the Geodatabase class."&lt;/SPAN&gt;&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;EM style="background-color: #ffffff; color: #333333; font-size: 13px;"&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;So do you always need to dispose a temporary geodatabase created for some reason within the app? &amp;nbsp;Would there be issues if I did not dispose the tempGDB at all? &amp;nbsp;What about if I only disposed the tempGDB on the final &amp;nbsp;tempGDB, ignoring the ones created during the loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a memory leak if the geodatabase is never disposed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff; font-size: 13px;"&gt;Ex:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;private void &lt;/SPAN&gt;&lt;SPAN style="color: #ffc66d;"&gt;someFunciton&lt;/SPAN&gt;(){
&amp;nbsp;&amp;nbsp; Geodatabase tempGDB&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp; for &lt;/SPAN&gt;(String gdbPath: &lt;SPAN style="color: #9876aa;"&gt;gdbArray&lt;/SPAN&gt;) {&amp;nbsp; &lt;SPAN style="color: #808080;"&gt;//gdbArray is just an array of strings that contains paths to GDB's
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;try &lt;/SPAN&gt;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempGDB = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Geodatabase(gdbPath)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;//does something with tempGDB
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //...finds all layers...etc.
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;tempGDB.dispose()&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;SPAN style="color: #cc7832;"&gt;catch&lt;/SPAN&gt;(Exception e){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:55:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/need-to-dispose-a-geodatabase-always/m-p/112#M4</guid>
      <dc:creator>ForrestKaye</dc:creator>
      <dc:date>2021-12-10T19:55:38Z</dc:date>
    </item>
  </channel>
</rss>

