Commit 41c38c0
authored
Fix memory leak by nullifying lifecycleObserver (#98)
## 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
- [x] This PR targets the `dev` branch (not `main`)
- [x] Commit messages follow the semantic-release format
- [x] No debug logs or sensitive data included
---
### Summary
Fixes a memory leak caused by mapView reference kept by
lifecycleObserver
---
### Type of change
- [ ] Feature
- [x] Fix
- [ ] Refactor
- [ ] Internal / CI
- [ ] Documentation
---
### Scope
- [x] 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.File tree
1 file changed
+1
-0
lines changed- android/src/main/java/com/rngooglemapsplus
1 file changed
+1
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
| 816 | + | |
816 | 817 | | |
817 | 818 | | |
818 | 819 | | |
| |||
0 commit comments