-
Notifications
You must be signed in to change notification settings - Fork 1.3k
(MapBox Android) MapBox onStop freezes main thread #14554
Comments
Some additional observations: I have noticed that zooming from a low zoom level (like 1) to a much higher zoom level (like 22) and then switching to a new activity without waiting that the MapView settles or the tiles are being rendered increases the blocking time for the main thread. I was even able to reproduce this issue on pretty strong hardware like Samsung S8 or Pixel XL. |
I did some more testing and tried out running the MapView in textureMode (app:mapbox_renderTextureMode="true"). I have noticed that in this mode, I have no main thread freezes at all. |
Thanks for the report @Mordag. Using the profiler I've noticed that it's the mapbox-gl-native/platform/android/src/map_renderer.cpp Lines 198 to 202 in cb73f0d
and because surface callbacks are invoked on the main thread it seems to freeze: Lines 36 to 50 in cb73f0d
Profiled overhead was around 70-125ms on the Pixel 2 XL, depending on the GL thread load. @tobrun @ivovandongen do you think we can safely move the renderer pointer reset to the GL thread? |
Of course, this is already happening. What I wanted to ask is does it have to be blocking? |
Ideally we do not reset renderer at all and fix the root destructor crash with edit: re ideally we do not reset renderer -> #14618 |
IIRC we block there as to make sure all gl resources are cleaned up before the egl context is destroyed. |
I am using a MapView inside a Fragment. I have noticed that switching to a different Activity (and therefore calling the onStop of that Fragment that is called the onStop of the MapView), freezes the main thread for a while. Especially slower phones have quite some troubles with that.
Configuration
Android versions: 7.0, 8.1
Device models: Moto G5, Nexus 5, Nexus 5X
Mapbox SDK versions: 7.4.0-beta.2
The text was updated successfully, but these errors were encountered: