-
-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activity leaking with interaction between KOIN, ViewModel, and NavHostFragment #149
Comments
Can you provide your code sample? Memory leak can also depend on your usage of Koin. |
Here's a gist with what I believe are all the relevant files: https://gist.github.com/trobertsca/dd1acd78a0d3e9636893c4258933b1a5 If you need anything more just let me know. (And excuse the code, I'm somewhat new to kotlin+android :) ) |
Does one of your parameters reference a ViewModel? |
No, the only parameters passed with koin would be a Context for the RoomDatabase, the Dao for the Repository, the Repository for ViewModels, and an int for a ViewModel. |
@trobertsca could you help me save time, by making a real android project and share it as a public github project? |
Kind of "good news". I reproduced a memory leak with ViewModel & injection parameters :/ I can investigate... |
it's fixed. Just need time to release it. Available in |
Awesome! You rock :) |
Describe the bug
When injecting a ViewModel(with parameters) with KOIN, an Activity is being leaked through KoinFactory->ViewModel->Fragment->NavHostFragment->NavController->Activity.
To Reproduce
Expected behavior
No memory leak.
Koin project used and used version (please complete the following information):
koin-core, -android, -android-architecture 0.9.3
androidx.Navigation - 1.0.0-alpha02
Additional context'
LeakCanary report:
https://gist.github.com/trobertsca/c56cb2a87be67b4ad1e54f5f54a44f4c
I'm not 100% sure this is due to KOIN, but my google-fu is failing me.
The text was updated successfully, but these errors were encountered: