mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Mapbox SDK memory leak detected! MapboxMap object (accessing getStyle) should not be stored and used after MapView is destroyed.

Open swathysreenivas opened this issue 2 years ago • 1 comments

Environment

  • Android OS version: 12
  • Devices affected: Pixel 4 a
  • Maps SDK Version: 10.7.0

Observed behavior and steps to reproduce

Integrated map SDK and react native bridging done. Unfortunately, the app got stuck and got an error as Mapbox SDK memory leak detected!

Expected behavior

Map view with navigation should be displayed

Notes / preliminary analysis

It was working fine when placed as an initial screen. Error got when used as an inner component of another view.

Additional links and references

swathysreenivas avatar Oct 03 '22 09:10 swathysreenivas

Getting a similar issue,

E/Mapbox: [maps-android\Mbgl-Style]: Mapbox SDK memory leak detected! Style object (accessing setStyleLayerProperty) should not be stored and used after MapView is destroyed or a new style has been loaded.
E/Mapbox: [maps-android\Mbgl-Style]: Mapbox SDK memory leak detected! Style object (accessing styleLayerExists) should not be stored and used after MapView is destroyed or a new style has been loaded.

My guess is, styleLayer is not being destroyed along with the map

Edit:

I just realized the error goes away when I remove the UserLocation Puck. It seems that the setStyle is not disabled somehow?

IsaacTrevino avatar Oct 17 '22 15:10 IsaacTrevino

@IsaacTrevino, @swathysreenivas are you able to reproduce this issue on our most recent SDK, v10.9.0?

ZiZasaurus avatar Oct 24 '22 14:10 ZiZasaurus

@ZiZasaurus Yes, I have just finished testing it with 10.9.0 and the bug persists. Screenshot_20221024_113908_2

I have narrowed down where the call may be coming from: plugin/locationcomponent/LocationLayerWrapper.kt

IsaacTrevino avatar Oct 24 '22 16:10 IsaacTrevino