Open guitabalipa opened 1 year ago
@guitabalipa it looks like your application is holding onto a reference to the MapView.
com.example.MainActivity
Do you have this reproducible in a stand-alone application? Also what versions did this start happening in? What version can you roll back to that stops the leak from occurring?
@dudeuter No, Ive only tried to reproduce in our project, I just changed the package to com.example
for anonymity.
I tried to test with all the versions that we used in the past year: 10.16.0 -> has the leak 10.10.1 -> has the leak 10.8.1 -> has the leak 10.7.0 -> Do not have the leak
Between those versions we didn't change much the implementation code.
Also, the 10.7.0 version is the only one that uses the 6.7.0 Mapbox sdk services version, all the others use 6.8.0. Dont know if this can be related, only add it for your information.
@guitabalipa Taking another look at this. Is it possible for you to take a capture of your Java heap to visualize in perfetto ui? Or maybe create a stand-alone example that can reproduce this leak?
Right now from what you've shared, it seems like there's likely a leak in the implementation code, and I haven't heard of such a leak from any other users. Not to dismiss this issue, but I don't have any direct clues to root cause.
@dudeuter Is there any secure channel that I could send the java heap file for you? I don't want to send it here since it could contain some company internal information.
@guitabalipa Certainly, and apologies for not responding sooner; I've had a lot of actions on my end the past few days. Can you create a ticket on our Support Form and mention my handle in the body of your request? Our Support Team will assign the ticket to me. You should be able to upload attachments there as well.
Thanks @dudeuter, just sent the form, let me know if you need anything more.
This memory leak can still be reproduced in version 11.2.2
Hi @vladteleport,
This is likely an issue in your implementation. I'm unable to reproduce this internally. I would recommend using the Android Tools to profile your application. https://developer.android.com/studio/profile/memory-profiler
This memory leak can still be reproduced in version 11.2.2
There is a memory leak in versions 11.2 and above. By using MVVM and Hilt, I shouldn't have a problem with persistent Mapbox references. However, when I return to the map 3 or 4 times, the app crashes. I am forced to destroy the map each time I exit, by calling mapview.onDestroy() to ensure that instances are not duplicated. This is the only solution I have found.
@Asgarde Thanks for sharing your idea,
Also mapview.onDestroy()
works for me.
As mentioned in previous comments, you have to call mapview.onDestroy()
After internal discussion, we decided to reopen the issue and investigate why in certain cases you need to call mapview.onDestroy()
manually in SDK v 11.2.2+. So I've already opened an internal ticket.
I would appreciate it if anybody could provide an example that reproduces the issue.
Environment
Observed behavior and steps to reproduce
A memory leak started to occur a while ago, it doesn't seem be related with any changes in our implementation but something internal in the SDK. The leak happens every time we enter a screen that has the map view. Also, we were only able to reproduce it when using
Don't keep activities
settingsExpected behavior
No memory leak.
Notes / preliminary analysis
Additional links and references