我有这个泄漏,你猜?这个类有一些奇怪的引用。我的代码的任何地方都没有内容观察者
In com.example:1.5.0:27.
com.example.ui.record.RecordFragment has leaked:
GC ROOT android.database.ContentObserver$Transport.mContentObserver
references com.android.internal.policy.impl.PhoneWindow$SettingsObserver.this$0
references com.android.internal.policy.impl.PhoneWindow.mContext
references com.example.ui.record.RecordActivity.mFragments
references android.support.v4.app.FragmentController.mHost
references android.support.v4.app.FragmentActivity$HostCallbacks.mFragmentManager
references android.support.v4.app.FragmentManagerImpl.mActive
references java.util.ArrayList.array
references array java.lang.Object[].[0]
leaks com.example.ui.record.RecordFragment instance
Reference Key: 15e51332-44bb-4550-864f-94023164e99c
Device: Sony Sony Xperia SP C5303
Android Version: 5.1.1 API: 22 LeakCanary: 1.3.1
Durations: watch=5184ms, gc=176ms, heap dump=4015ms, analysis=25675ms
Details:
Instance of android.database.ContentObserver$Transport
mContentObserver = com.android.internal.policy.impl.PhoneWindow$SettingsObserver [id=0x1316a8e0]
mDescriptor = java.lang.String [id=0x7016e998]
mObject = -1187059096
mOwner = android.database.ContentObserver$Transport [id=0x1317f640]
Instance of com.android.internal.policy.impl.PhoneWindow$SettingsObserver
this$0 = com.android.internal.policy.impl.PhoneWindow [id=0x12eb58e0]
mHandler = android.os.Handler [id=0x1316a900]
mLock = java.lang.Object [id=0x13142b50]
mTransport = android.database.ContentObserver$Transport [id=0x1317f640]
Instance of com.android.internal.policy.impl.PhoneWindow
static $staticOverhead = byte[] [id=0x70a3d751;length=104;size=120]
static ACTION_BAR_TAG = java.lang.String [id=0x701d20a0]
static CUSTOM_TITLE_COMPATIBLE_FEATURES = 13505
static DEFAULT_BACKGROUND_FADE_DURATION_MS = 300
static FLAG_RESOURCE_SET_ICON = 1
static FLAG_RESOURCE_SET_ICON_FALLBACK = 4
static FLAG_RESOURCE_SET_LOGO = 2
static FOCUSED_ID_TAG = java.lang.String [id=0x701d20d0]
static PANELS_TAG = java.lang.String [id=0x701d20b8]
static SWEEP_OPEN_MENU = false
static TAG = java.lang.String [id=0x701d1ab8]
static USE_DEFAULT_TRANSITION = android.transition.TransitionSet [id=0x743b9138]
static VIEWS_TAG = java.lang.String [id=0x701d20e8]
我使用 LeakCanary 来获取此日志,这是 Activity 中的 Fragment。