Open ristiisa opened 1 month ago
Hi @ristiisa, thank you for the detailed report! I'm able to reproduce this behavior, created an issue in our internal issue tracker: https://mapbox.atlassian.net/browse/MAPSFLT-202
Hi @ristiisa
This one looks like a bug on the Flutter side. As soon as we switch the index of the IndexedStack
to show the MapView, extra allocations simply go away.
Also according to the memory profiling, this is only the Flutter guts that hold extra MapView references.
There is not much we can do to fix that on the Mapbox side, unfortunately 🙁 .
Hi @ristiisa This one looks like a bug on the Flutter side. As soon as we switch the index of the
IndexedStack
to show the MapView, extra allocations simply go away. Also according to the memory profiling, this is only the Flutter guts that hold extra MapView references. There is not much we can do to fix that on the Mapbox side, unfortunately 🙁 .
That is unfortunate... Have you discovered a workaround?
To be honest we actually stopped using this library due to the issues we were having and I created our own streamlined wrapper over native Mapbox SDK.
We have a tabbed interface with several maps on screen at once per tab. Since map initialisation causes some "flicker" I designed our wrapper so that the native view could be always"recycled". So after going over our code real quick I can verify that the memory leak is present for our implementation aswell with the sample code provided. However since we recycle the maps the key for the map is a global one and thus it will not be initialised with every rebuild.
So I guess the workaround would be (if applicable):
I'll try to figure out a repro code without Mapbox and submit a issue to flutter team.
for future reference: https://github.com/flutter/flutter/issues/148639
FYI, I have similar issue(but rather fps drop), and for me disabling location via LocationComponentSettings(enabled: false...)
fixes it..
Android only
It seems that if the map is in an IndexedStack and is not visible, then some kind of a condition is triggered that allows the memory usage to grow until no more memory can be allocated and the app crashes.
Over the course of 114s the app allocated 10GB of memory:
Not for the same run, but I assume the details are the same:
https://github.com/ristiisa/mbmemleak