<?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: ANR when adding GraphicsOverlays with large graphic counts in Kotlin Maps SDK Questions</title>
    <link>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1717549#M652</link>
    <description>&lt;P&gt;I believe this is related question&amp;nbsp;&lt;A href="https://community.esri.com/t5/kotlin-maps-sdk-questions/mapview-is-disposed-way-too-long-with-a-lot-of/m-p/1659251#M611" target="_blank"&gt;https://community.esri.com/t5/kotlin-maps-sdk-questions/mapview-is-disposed-way-too-long-with-a-lot-of/m-p/1659251#M611&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2026 10:45:10 GMT</pubDate>
    <dc:creator>dev4567</dc:creator>
    <dc:date>2026-07-30T10:45:10Z</dc:date>
    <item>
      <title>ANR when adding GraphicsOverlays with large graphic counts</title>
      <link>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1709726#M650</link>
      <description>&lt;P&gt;Hello, o&lt;SPAN&gt;ur app loads user-submitted map features onto a map. Each feature has a geometry type (point, line, polygon) and a color. We group features into&amp;nbsp;&lt;/SPAN&gt;GraphicsOverlay&lt;SPAN&gt;&amp;nbsp;objects by&amp;nbsp;&lt;/SPAN&gt;(type, color)&lt;SPAN&gt;&amp;nbsp;pair — so a dataset with 3 geometry types × 5 colors produces at most 15 overlays, each containing N graphics. In production we see datasets with up to 15,000 total graphics spread across a small number of overlays (e.g. 2 overlays: 8,000 red points + 7,000 blue polygons).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We are seeing an&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;ApplicationNotResponding&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;error rooted in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;CoreVector.nativeAdd&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;via&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;pthread_mutex_lock:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;at java.util.AbstractCollection.addAll&lt;BR /&gt;at com.arcgismaps.internal.collections.MutableListImpl.add&lt;BR /&gt;at com.arcgismaps.internal.jni.CoreVector.nativeAdd&lt;BR /&gt;at UnknownClass.RT_Vector_add&lt;BR /&gt;...&lt;BR /&gt;at UnknownClass.NonPI::MutexLockWithTimeout&lt;BR /&gt;at UnknownClass.__futex_wait_ex&lt;BR /&gt;at UnknownClass.syscall&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;This occurs most reliably on app resume after a long background period (60+ minutes) during which the SDK appears to have queued a large number of tile loads. When the app resumes, the rendering thread holds the native mutex during a tile burst, and our main thread blocks waiting to acquire it.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;We came across the following post, which may be related to this issue:&amp;nbsp;&lt;A title="MapView is disposed way too long with a lot of Graphic in certain conditions" href="https://community.esri.com/t5/kotlin-maps-sdk-questions/mapview-is-disposed-way-too-long-with-a-lot-of/m-p/1658736#M605" target="_blank" rel="noopener"&gt;MapView is disposed way too long with a lot of Graphic in certain conditions&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;STRONG&gt;What we do off the main thread&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We build all&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;GraphicsOverlay&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;objects and populate&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;overlay.graphics&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;on a background IO dispatcher before touching&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mapView.graphicsOverlays:&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;LI-CODE lang="kotlin"&gt;// IO dispatcher
return withContext(Dispatchers.IO) {
    val overlay = GraphicsOverlay(renderingMode = GraphicsRenderingMode.Static)
    overlay.renderer = SimpleRenderer(symbol)
    overlay.labelDefinitions.add(labelDefinition)
    overlay.graphics.addAll(graphicsList)   // 8,000 graphics added here, off main
    overlay  // returned as a plain object, not yet registered
}

// Main dispatcher — MapView
withContext(Dispatchers.Main) {
    mapView.graphicsOverlays.add(overlay)   // registration: only this on main
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions for the community:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Thread safety of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;graphicsOverlays.add()&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it strictly required to call&amp;nbsp;&lt;/SPAN&gt;mapView.graphicsOverlays.add()&lt;SPAN&gt;&amp;nbsp;on the main thread, or does the SDK provide any thread-safe API for registering overlays? &lt;/SPAN&gt;GeoView&lt;SPAN&gt;&amp;nbsp;extends&amp;nbsp;&lt;/SPAN&gt;FrameLayout&lt;SPAN&gt;, so we assume the Android single-threaded view rule applies — but we want to confirm.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Thread safety of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;overlay.graphics.addAll()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;before registration&lt;/STRONG&gt;&lt;BR /&gt;We populate&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;overlay.graphics&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;on a background thread before calling&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;graphicsOverlays.add(). Is this safe? Our assumption is that an unregistered overlay has no native render-thread involvement yet, so off-thread mutation is safe. Is this correct?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. Recommended pattern for large graphic counts&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there an recommended maximum number of graphics per overlay or per map view for&amp;nbsp;&lt;/SPAN&gt;GraphicsRenderingMode.Static&lt;SPAN&gt;&amp;nbsp;before frame drops become significant? For 15,000 total graphics across 2 overlays on a modern high-end device, is per-overlay batching the right approach, or should we consider a different architecture (e.g. feature layers, clustering)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4. Mutex contention on app resume&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The ANR stack trace shows&amp;nbsp;&lt;/SPAN&gt;NonPI::MutexLockWithTimeout&lt;SPAN&gt;&amp;nbsp;blocking on a futex. Is there a way to explicitly yield or pause the SDK's rendering pipeline&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;during bulk overlay registration to avoid this contention on resume?&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;5. Alternative APIs for large static datasets&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;For a use case involving large numbers of static geometries — potentially 10,000+ features that do not change until the visible area is refreshed — is&amp;nbsp;&lt;/SPAN&gt;GraphicsOverlay&lt;SPAN&gt;&amp;nbsp;the recommended API, or does the SDK provide alternative rendering approaches better suited to this scale? We are looking for guidance on what architecture would recommend when graphic counts grow beyond what&amp;nbsp;&lt;/SPAN&gt;GraphicsOverlay&lt;SPAN&gt;&amp;nbsp;handles comfortably.&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Thanks in advance!&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Jun 2026 23:27:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1709726#M650</guid>
      <dc:creator>CristhianSanchez</dc:creator>
      <dc:date>2026-06-24T23:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: ANR when adding GraphicsOverlays with large graphic counts</title>
      <link>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1716779#M651</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I wanted to kindly follow up on this thread to see whether there are any updates on this ANR issue.&lt;/P&gt;&lt;P&gt;We’re still seeing multiple variations of the same underlying problem in production, and it’s having a significant impact on our users. We’d greatly appreciate any guidance from the team, whether that’s known workarounds, recommended mitigation strategies, or confirmation that this is being investigated.&lt;/P&gt;&lt;P&gt;If helpful, we can also share additional traces and reproduction details from our side.&lt;/P&gt;&lt;P&gt;Thank you very much for your time and support.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2026 14:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1716779#M651</guid>
      <dc:creator>NicoleLeiva25</dc:creator>
      <dc:date>2026-07-27T14:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: ANR when adding GraphicsOverlays with large graphic counts</title>
      <link>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1717549#M652</link>
      <description>&lt;P&gt;I believe this is related question&amp;nbsp;&lt;A href="https://community.esri.com/t5/kotlin-maps-sdk-questions/mapview-is-disposed-way-too-long-with-a-lot-of/m-p/1659251#M611" target="_blank"&gt;https://community.esri.com/t5/kotlin-maps-sdk-questions/mapview-is-disposed-way-too-long-with-a-lot-of/m-p/1659251#M611&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2026 10:45:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/kotlin-maps-sdk-questions/anr-when-adding-graphicsoverlays-with-large/m-p/1717549#M652</guid>
      <dc:creator>dev4567</dc:creator>
      <dc:date>2026-07-30T10:45:10Z</dc:date>
    </item>
  </channel>
</rss>

