android / android/nowinandroid
[Bug]: Compose-related memory leaks
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is there a StackOverflow question about this issue?
- [X] I have searched StackOverflow
### What happened?
The `SearchViewModel` (and likely other ViewModels) appears to leak after navigating to the search screen and back to the main screen. This seems to be related to [this Compose issue](https://issuetracker.google.com/issues/312895362).
**Steps to reproduce**
- Open the app.
- Navigate to the search screen.
- Enter text in the search field.
- Exit the search screen.
- Open the memory profiler, attempt to force a garbage collection several times, and then collect a heap dump.
- Search for `SearchViewModel` in the heap.
The `SearchViewModel` will still be present in the heap even though the screen was left and many garbage collections were attempted.
### Relevant logcat output
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.