Skip to content

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

Merged
pinpong merged 1 commit intopinpong:devfrom
ottor-o:dev
Feb 1, 2026
Merged

fix(android): Memory leak from lifecycleObserver mapView reference#98
pinpong merged 1 commit intopinpong:devfrom
ottor-o:dev

Conversation

@ottor-o
Copy link
Copy Markdown
Contributor

@ottor-o ottor-o commented Jan 31, 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 pinpong merged commit 41c38c0 into pinpong:dev Feb 1, 2026
6 checks passed
@pinpong
Copy link
Copy Markdown
Owner

pinpong commented Feb 1, 2026

@ottor-o thanks for your contribution.

@ottor-o ottor-o changed the title Fix memory leak by nullifying lifecycleObserver fix(android): memory leak by nullifying lifecycleObserver Feb 1, 2026
@ottor-o ottor-o changed the title fix(android): memory leak by nullifying lifecycleObserver fix(android): Memory leak from lifecycleObserver mapView reference Feb 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 9, 2026

🎉 This PR is included in version 1.11.1-dev.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants