Skip to content

fix(android): Memory leak from lifecycleObserver mapView reference#97

Closed
ottor-o wants to merge 3 commits intopinpong:devfrom
ottor-o:main
Closed

fix(android): Memory leak from lifecycleObserver mapView reference#97
ottor-o wants to merge 3 commits intopinpong:devfrom
ottor-o:main

Conversation

@ottor-o
Copy link

@ottor-o ottor-o commented Jan 30, 2026

Pull request

Please ensure this PR targets the dev branch and follows the project conventions.
CI already runs linting, formatting, and build checks automatically.


Before submitting

  • This PR targets the dev branch (not main)
  • Commit messages follow the semantic-release format
  • No debug logs or sensitive data included

Summary

Fixes a memory leak caused by mapView reference kept by lifecycleObserver


Type of change

  • Feature
  • Fix
  • Refactor
  • Internal / CI
  • Documentation

Scope

  • Android
  • iOS
  • JS
  • Example App
  • Docs

Additional notes

There's a memory leak caused by lifecycleObserver apparently because if keeps a reference of mapView. Nullifying lifecycleObserver fixed it for me.

The memory leak can be observed by putting GoogleMapsView on a stack or a modal and then closing and navigating to it multiple times. The easiest way to reproduce it is to render GoogleMapsView on a flatlist a few hundred times and to scroll back and forth causing an out of memory crash.

pinpong and others added 3 commits January 27, 2026 09:35
## [1.11.0](pinpong/react-native-google-maps-plus@v1.10.2...v1.11.0) (2026-01-27)

### ✨ Features

* transit layer support ([5db65ea](pinpong@5db65ea))

### 🐛 Bug Fixes

* **podspec:** correct source_files patterns ([ffb01cb](pinpong@ffb01cb))

### 📚 Documentation

* fix warning ([417fd45](pinpong@417fd45))
* **types:** improve type documentation links ([1683bfb](pinpong@1683bfb))

### 🛠️ Other changes

* **android:** update android-maps-utils ([986c008](pinpong@986c008))
* **android:** update maps sdk ([e85acce](pinpong@e85acce))
* apply ktlint formatting ([b8f6850](pinpong@b8f6850))
* **example:** transit layer support ([b7ea377](pinpong@b7ea377))
* **ios:** update maps sdk ([63ea155](pinpong@63ea155))
* merge dev into main ([c6d58b7](pinpong@c6d58b7))
* merge dev into main ([0ebfd30](pinpong@0ebfd30))
* update dependencies ([f06ae6f](pinpong@f06ae6f))
* update dependencies ([1ebc567](pinpong@1ebc567))
* update README.md ([dc1f75f](pinpong@dc1f75f))
* update to react-native 0.83.1 ([94f7978](pinpong@94f7978))
@pinpong
Copy link
Owner

pinpong commented Jan 31, 2026

Thanks for the PR, the soruce branch is currently based on main.
Please rebase it onto pinpong:dev (or recreate the branch from pinpong:dev and cherry-pick the fix) so that the PR only includes the relevant changes and no unrelated commits.

@ottor-o ottor-o closed this Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants