react-native-maps: Multi-instance Memory Leak

On Android, when using react-native-maps with the react-native-router-flux router, when a map is loaded over and over, there is a large memory leak that can result in an application crash.

It appears that the map instance is not disposed of. After a short look at a heap dump, it seems like ‘AirMapView’ is not getting disposed. I suspect this is a native Java wrapper around the Google Maps instance.

It looks like the issue was introduced after 0.10.1, and exists in 0.11.0.

I’ve created a simple project to make this issue easy to reproduce.

https://github.com/gregberns/ReactNativeMapTest

I haven’t done much work with this project or RN’s native components, but I’ll try and dig in a little further and see where it can go, but any help to resolve this would be very welcome.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Looks this was introduced by PR #694, made by @felipecsl , merged by @spikebrehm. Calls to AirMapView.doDestroy() were removed to fix #414. Thats the only change I can see that seems like it could cause the extra map instances.