<?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: MapView - Leak memory in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257831#M5975</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/476225"&gt;@Shubham_Sharma&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for your response, but actually, I am calling mapView.dispose() on onDestroyView of Fragment and before super().&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Leaking: YES (View.mContext references a destroyed activity)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;For the log above, you can see the geoView is referencing to a destroyed activity, in case we call mapView.dispose after destroy, it should throw null pointer exception&lt;/P&gt;</description>
    <pubDate>Tue, 14 Feb 2023 02:13:19 GMT</pubDate>
    <dc:creator>MinhPham92</dc:creator>
    <dc:date>2023-02-14T02:13:19Z</dc:date>
    <item>
      <title>MapView - Leak memory</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257427#M5968</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;I am facing a leak memory as logged below, I am using leak canary to found that.&lt;BR /&gt;I already called &lt;STRONG&gt;mapView.dispose() and &lt;/STRONG&gt;see the log&amp;nbsp;&lt;SPAN&gt;"&lt;STRONG&gt;TextureView&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;RenderingThread - disposed&lt;/STRONG&gt;"&amp;nbsp;before leak canary dump the memory. Could you please help to take a look ?&lt;BR /&gt;Thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;├─ Dalvik.system.PathClassLoader instance&lt;BR /&gt;&lt;SPAN&gt;2    &lt;/SPAN&gt;│    Leaking: NO (b↓ &lt;SPAN&gt;is &lt;/SPAN&gt;not leaking and A ClassLoader &lt;SPAN&gt;is &lt;/SPAN&gt;never leaking)&lt;BR /&gt;&lt;SPAN&gt;3    &lt;/SPAN&gt;│    ↓ ClassLoader.runtimeInternalObjects&lt;BR /&gt;&lt;SPAN&gt;4    &lt;/SPAN&gt;├─ java.lang.Object[] array&lt;BR /&gt;&lt;SPAN&gt;5    &lt;/SPAN&gt;│    Leaking: NO (b↓ &lt;SPAN&gt;is &lt;/SPAN&gt;not leaking)&lt;BR /&gt;&lt;SPAN&gt;6    &lt;/SPAN&gt;│    ↓ Object[&lt;SPAN&gt;731&lt;/SPAN&gt;]&lt;BR /&gt;&lt;SPAN&gt;7    &lt;/SPAN&gt;├─ com.esri.arcgisruntime.&lt;SPAN&gt;internal&lt;/SPAN&gt;.b.b &lt;SPAN&gt;class&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;8    &lt;/SPAN&gt;│    Leaking: NO (a &lt;SPAN&gt;class is &lt;/SPAN&gt;never leaking)&lt;BR /&gt;&lt;SPAN&gt;9    &lt;/SPAN&gt;│    ↓ static b.WRAPPER_CACHE&lt;BR /&gt;&lt;SPAN&gt;10    &lt;/SPAN&gt;│               ~~~~~~~~~~~~~&lt;BR /&gt;&lt;SPAN&gt;11    &lt;/SPAN&gt;├─ com.esri.arcgisruntime.&lt;SPAN&gt;internal&lt;/SPAN&gt;.b.h instance&lt;BR /&gt;&lt;SPAN&gt;12    &lt;/SPAN&gt;│    Leaking: UNKNOWN&lt;BR /&gt;&lt;SPAN&gt;13    &lt;/SPAN&gt;│    Retaining &lt;SPAN&gt;4.2 &lt;/SPAN&gt;MB &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;115754 &lt;/SPAN&gt;objects&lt;BR /&gt;&lt;SPAN&gt;14    &lt;/SPAN&gt;│    ↓ h.mCache&lt;BR /&gt;&lt;SPAN&gt;15    &lt;/SPAN&gt;│        ~~~~~~&lt;BR /&gt;&lt;SPAN&gt;16    &lt;/SPAN&gt;├─ java.util.concurrent.ConcurrentHashMap instance&lt;BR /&gt;&lt;SPAN&gt;17    &lt;/SPAN&gt;│    Leaking: UNKNOWN&lt;BR /&gt;&lt;SPAN&gt;18    &lt;/SPAN&gt;│    Retaining &lt;SPAN&gt;4.2 &lt;/SPAN&gt;MB &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;115753 &lt;/SPAN&gt;objects&lt;BR /&gt;&lt;SPAN&gt;19    &lt;/SPAN&gt;│    ↓ ConcurrentHashMap[instance @&lt;SPAN&gt;319226872 &lt;/SPAN&gt;of java.lang.Long]&lt;BR /&gt;&lt;SPAN&gt;20    &lt;/SPAN&gt;│                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;&lt;SPAN&gt;21    &lt;/SPAN&gt;├─ com.esri.arcgisruntime.&lt;SPAN&gt;internal&lt;/SPAN&gt;.h.b.g$b instance&lt;BR /&gt;&lt;SPAN&gt;22    &lt;/SPAN&gt;│    Leaking: UNKNOWN&lt;BR /&gt;&lt;SPAN&gt;23    &lt;/SPAN&gt;│    Retaining &lt;SPAN&gt;4.2 &lt;/SPAN&gt;MB &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;115749 &lt;/SPAN&gt;objects&lt;BR /&gt;&lt;SPAN&gt;24    &lt;/SPAN&gt;│    ↓ g$b.a&lt;BR /&gt;&lt;SPAN&gt;25    &lt;/SPAN&gt;│          ~&lt;BR /&gt;&lt;SPAN&gt;26    &lt;/SPAN&gt;├─ com.esri.arcgisruntime.&lt;SPAN&gt;internal&lt;/SPAN&gt;.h.b.o instance&lt;BR /&gt;&lt;SPAN&gt;27    &lt;/SPAN&gt;│    Leaking: UNKNOWN&lt;BR /&gt;&lt;SPAN&gt;28    &lt;/SPAN&gt;│    Retaining &lt;SPAN&gt;4.2 &lt;/SPAN&gt;MB &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;115740 &lt;/SPAN&gt;objects&lt;BR /&gt;&lt;SPAN&gt;29    &lt;/SPAN&gt;│    ↓ g.mGeoView&lt;BR /&gt;&lt;SPAN&gt;30    &lt;/SPAN&gt;│        ~~~~~~~~&lt;BR /&gt;&lt;SPAN&gt;31    &lt;/SPAN&gt;├─ com.esri.arcgisruntime.mapping.view.MapView instance&lt;BR /&gt;&lt;SPAN&gt;32    &lt;/SPAN&gt;│    Leaking: YES (View.mContext references a destroyed activity)&lt;BR /&gt;&lt;SPAN&gt;33    &lt;/SPAN&gt;│    Retaining &lt;SPAN&gt;551.2 &lt;/SPAN&gt;kB &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;9727 &lt;/SPAN&gt;objects&lt;BR /&gt;&lt;SPAN&gt;34    &lt;/SPAN&gt;│    View not part of a window view hierarchy&lt;BR /&gt;&lt;SPAN&gt;35    &lt;/SPAN&gt;│    View.mAttachInfo &lt;SPAN&gt;is null &lt;/SPAN&gt;(view detached)&lt;BR /&gt;&lt;SPAN&gt;36    &lt;/SPAN&gt;│    View.mID = R.id.mapView&lt;BR /&gt;&lt;SPAN&gt;37    &lt;/SPAN&gt;│    View.mWindowAttachCount = &lt;SPAN&gt;1&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;38    &lt;/SPAN&gt;│    mContext instance of com......MyActivity with mDestroyed = &lt;SPAN&gt;true&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;39    &lt;/SPAN&gt;│    ↓ View.mContext&lt;BR /&gt;&lt;SPAN&gt;40    &lt;/SPAN&gt;╰→ com........MyActivity instance&lt;BR /&gt;&lt;SPAN&gt;41    &lt;/SPAN&gt;​     Leaking: YES (ObjectWatcher was watching &lt;SPAN&gt;this &lt;/SPAN&gt;because com.......MyActivity received&lt;BR /&gt;&lt;SPAN&gt;42    &lt;/SPAN&gt;​     Activity#onDestroy() callback and Activity#mDestroyed &lt;SPAN&gt;is true&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;43    &lt;/SPAN&gt;​     Retaining &lt;SPAN&gt;207.4 &lt;/SPAN&gt;kB &lt;SPAN&gt;in &lt;/SPAN&gt;&lt;SPAN&gt;3681 &lt;/SPAN&gt;objects&lt;BR /&gt;&lt;SPAN&gt;44    &lt;/SPAN&gt;​     key = b5f097e7-&lt;SPAN&gt;68&lt;/SPAN&gt;d9-&lt;SPAN&gt;4e29&lt;/SPAN&gt;-ab0b-d96684f9cfa0&lt;BR /&gt;&lt;SPAN&gt;45    &lt;/SPAN&gt;​     watchDurationMillis = &lt;SPAN&gt;5266&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;46    &lt;/SPAN&gt;​     retainedDurationMillis = &lt;SPAN&gt;233&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;47    &lt;/SPAN&gt;​     mApplication instance of com......MyApplication&lt;BR /&gt;&lt;SPAN&gt;48    &lt;/SPAN&gt;​     mBase instance of androidx.appcompat.view.ContextThemeWrapper&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2023 04:19:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257427#M5968</guid>
      <dc:creator>MinhPham92</dc:creator>
      <dc:date>2023-02-13T04:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: MapView - Leak memory</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257822#M5974</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/656736"&gt;@MinhPham92&lt;/a&gt;&amp;nbsp;Seems like you are accessing the &lt;STRONG&gt;MapView&lt;/STRONG&gt; by calling &lt;STRONG&gt;dispose()&lt;/STRONG&gt; after the activity is destroyed (or context is lost) based on the log messages:&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;Leaking: YES (View.mContext references a destroyed activity)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggest calling &lt;STRONG&gt;dispose()&lt;/STRONG&gt; before destroying the activity.&lt;/P&gt;&lt;LI-CODE lang="kotlin"&gt;override fun onDestroy() {
    mapView.dispose()
    super.onDestroy()
}

override fun onPause() {
    mapView.pause()
    super.onPause()
}

override fun onResume() {
    super.onResume()
    mapView.resume()
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 01:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257822#M5974</guid>
      <dc:creator>Shubham_Sharma</dc:creator>
      <dc:date>2023-02-14T01:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: MapView - Leak memory</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257831#M5975</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/476225"&gt;@Shubham_Sharma&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;Thanks for your response, but actually, I am calling mapView.dispose() on onDestroyView of Fragment and before super().&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Leaking: YES (View.mContext references a destroyed activity)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;For the log above, you can see the geoView is referencing to a destroyed activity, in case we call mapView.dispose after destroy, it should throw null pointer exception&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 02:13:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1257831#M5975</guid>
      <dc:creator>MinhPham92</dc:creator>
      <dc:date>2023-02-14T02:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: MapView - Leak memory</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1268852#M6002</link>
      <description>&lt;P&gt;Does any one have any idea ?&lt;BR /&gt;&lt;BR /&gt;I am using version 100.14&lt;/P&gt;&lt;P&gt;My exactly scenario:&lt;BR /&gt;I have an activityA -&amp;gt; contains fragmentA -&amp;gt; fragmentA contains MapFragment which has map view.&lt;BR /&gt;When&amp;nbsp;MapFragment destroy view, I call mapView.dispose() before super and I already see the log&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;TextureView&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;RenderingThread - disposed,&amp;nbsp;&lt;/STRONG&gt;but after that, I see Rendering Thread is still keeping reference to activity context.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 03:54:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1268852#M6002</guid>
      <dc:creator>MinhPham92</dc:creator>
      <dc:date>2023-03-17T03:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: MapView - Leak memory</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1324204#M6115</link>
      <description>&lt;P&gt;Finally, I found the root cause, the root cause actually come from missing dispose map view, but it behinds another root cause as a scenario below:&lt;BR /&gt;1. I have 2 xml files: `&lt;STRONG&gt;fragment_A.xml&lt;/STRONG&gt;` has the map view, and another `&lt;STRONG&gt;fragment_B.xml&lt;/STRONG&gt;` has the map view also&lt;BR /&gt;2. In MapFragment, I bind view with &lt;STRONG&gt;fragment_A.xml&lt;/STRONG&gt;, and using &lt;STRONG&gt;ConstraintSet&lt;/STRONG&gt; to clone the arrangement between view component in &lt;STRONG&gt;fragment_B.xml&lt;/STRONG&gt;. After that, I used `&lt;SPAN&gt;&lt;STRONG&gt;TransitionManager&lt;/STRONG&gt;` to do the animation between 2 layouts.&lt;BR /&gt;Unfortunately, when &lt;STRONG&gt;ConstraintSet &lt;/STRONG&gt;do clone, it inflate the view, so the map view created via this step also. But we didn't aware about that.&lt;BR /&gt;So to resolve this, after &lt;STRONG&gt;ConstrainSet&amp;nbsp;&lt;/STRONG&gt;clone, we need to manually call dispose for map view&amp;nbsp;&lt;BR /&gt;Finally, totally, we need to aware &lt;STRONG&gt;how many time&lt;/STRONG&gt; we init the view which contains map view, we need to call &lt;STRONG&gt;dispose&amp;nbsp;&lt;/STRONG&gt;as the same quantity&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 04:26:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/mapview-leak-memory/m-p/1324204#M6115</guid>
      <dc:creator>MinhPham92</dc:creator>
      <dc:date>2023-08-31T04:26:40Z</dc:date>
    </item>
  </channel>
</rss>

