Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

InternalLifecycleIntegration memory leak on P emulator #280

Open
edenman opened this issue Oct 18, 2018 · 1 comment
Open

InternalLifecycleIntegration memory leak on P emulator #280

edenman opened this issue Oct 18, 2018 · 1 comment

Comments

@edenman
Copy link
Contributor

edenman commented Oct 18, 2018

In co.recharge.consumer.debug:1.15.2:96.
* flow.InternalLifecycleIntegration has leaked:
* static FontsContract.sContext
* ↳ DebugConsumerApp.injectedAuthenticatedStuff
* ↳ ConsumerApp$InjectedAuthenticatedStuff.onSignedInHelper
* ↳ OnSignedInHelper.signInHooks
* ↳ array OnSignedIn[].[4]
* ↳ PlaceDirections.placeIDToDirectionsRelays
* ↳ LinkedHashMap.tail
* ↳ LinkedHashMap$LinkedHashMapEntry.value
* ↳ BehaviorRelay.state
* ↳ RelaySubscriptionManager.value
* ↳ RelaySubscriptionManager$State.observers
* ↳ array RelaySubscriptionManager$RelayObserver[].[0]
* ↳ RelaySubscriptionManager$RelayObserver.actual
* ↳ OperatorObserveOn$ObserveOnSubscriber.child
* ↳ OnSubscribeOnAssembly$OnAssemblySubscriber.actual
* ↳ SafeSubscriber.actual
* ↳ ActionSubscriber.onNext
* ↳ WalkingTimeView$setPlace$1.this$0 (anonymous implementation of rx.functions.Action1)
* ↳ WalkingTimeView.!(mContext)!
* ↳ FlowContextWrapper.!(mBase)!
* ↳ MainActivity.mFragments
* ↳ FragmentController.mHost
* ↳ Activity$HostCallbacks.mFragmentManager
* ↳ FragmentManagerImpl.mAdded
* ↳ ArrayList.elementData
* ↳ array Object[].[0]
* ↳ InternalLifecycleIntegration

A fun thing I learned today is that Flow uses Fragments for some reason? I'm looking at the InternalLifecycleIntegration code and I'm pretty much baffled by what's going on. Looks like it attaches a fragment to the Activity in onCreate, but then somehow FragmentManager is keeping a reference to it even after the activity has been destroyed?

LeakCanary 1.6.2, fwiw

@Zhuinden
Copy link

InternalLifecycleIntegration is a retained fragment, yes, but you're leaking the observers of * ↳ PlaceDirections.placeIDToDirectionsRelays yourself.

You need to unsubscribe your lambdas. Use composite disposables.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants