-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Hello, as you may know, Hilt is causing a memory leak in Epoxy. Details are here airbnb/epoxy#1025
I believe it would be fixed in the ViewComponentManager$FragmentContextWrapper was implementing LifecycleOwner and would return the fragment lifecycle. Ex:
public static final class FragmentContextWrapper extends ContextWrapper implements LifecycleOwner {
...
@NonNull
@Override
public Lifecycle getLifecycle() {
return fragment.getLifecycle();
}
...
}
For details about why it would fix the memory leak see ActivityRecyclerPool.kt#L69. Epoxy would then use a view pool tied to the fragment lifecycle, not the activity. As FragmentContextWrapper contains a reference to a fragment, if the view pool is tied to the activity it will leak the fragment.
However I am not sure about all the implication this change would have on Hilt but it would make sense to be able to access the fragment lifecycle from the view's context?
What do you think ?
We use Hilt 2.29.1-alpha.
Thanks