Select to view content in your preferred language

MapView is disposed way too long with a lot of Graphic in certain conditions

115
2
2 weeks ago
dev4567
Emerging Contributor

# Context

We use `GraphicsOverlay` with a lot of graphic items (~10k). 

# Issue

When the `MapView` is destroyed right after the graphic items are added (e.g. within 5-10 secs) the `MapView` disposes for 2-5 seconds, which causes ANR . Instead if we wait for 5-10 secs right after adding the graphics and only then try to destroy `MapView`, dispose takes milliseconds and everything works fine.

# Details

As far as we understand 

this.getGraphicsOverlays().clear();

takes too much time if being called right after graphics are added to the `GraphicsOverlay`

dev4567_0-1760712635637.png
 
Here is the callstack: one could see `clear` takses mostly all the time of the `destroy` function.
dev4567_1-1760712641771.png

 

The issue is also seen in the LogCat (here are the logs for the Activity onStop/onStart lifecycle): TextureView disposing takes 15 secs

dev4567_2-1760712894543.png

I want to emphasise once more what is weird: if we wait for 5-10 secs right after adding the items and before destroying the view, disposing works normally.

Tags (2)
0 Kudos
2 Replies
dev4567
Emerging Contributor

important note: the problems exists only if

renderingMode = GraphicsRenderingMode.Dynamic

with `Static` rendering mode dispose works good

0 Kudos
dev4567
Emerging Contributor

We also see a very similar issue with the `FeatureCollectionLayer`, but now the disposable choke point is `setMap(null)`

dev4567_0-1761038675985.png

 

0 Kudos