我正在使用LeakCanary库来监控我的应用程序中的内存泄漏。我收到了这个内存泄漏,但不知道如何找出导致它的原因。
05-09 09:32:14.731 28497-31220/? D/LeakCanary﹕ In com.etiennelawlor.minesweeper:0.0.21:21.
* com.etiennelawlor.minesweeper.fragments.MinesweeperFragment has leaked:
* GC ROOT com.google.android.gms.games.internal.GamesClientImpl$PopupLocationInfoBinderCallbacks.zzahO
* references com.google.android.gms.games.internal.PopupManager$PopupManagerHCMR1.zzajo
* references com.google.android.gms.games.internal.GamesClientImpl.mContext
* references com.etiennelawlor.minesweeper.activities.MinesweeperActivity.mFragments
* references android.app.FragmentManagerImpl.mAdded
* references java.util.ArrayList.array
* references array java.lang.Object[].[0]
* leaks com.etiennelawlor.minesweeper.fragments.MinesweeperFragment instance
* Reference Key: 2f367393-6dfd-4797-8d85-7ac52c431d07
* Device: LGE google Nexus 5 hammerhead
* Android Version: 5.1 API: 22
* Durations: watch=5015ms, gc=141ms, heap dump=1978ms, analysis=23484ms
这是我的回购: https ://github.com/lawloretienne/Minesweeper
这似乎是一个难以捉摸的事情。我设置了一个在 a和Interface
a 之间进行通信。我设置了这个变量,然后我意识到我没有在. 我解决了这个问题,但仍然出现内存泄漏。有任何想法吗?Fragment
Activity
mCoordinator
Interface
onAttach()
onDetach()
更新
我禁用了Fragment
泄漏监视,但我仍然收到有关活动泄漏的通知,其中包含以下泄漏跟踪:
05-09 17:07:33.074 12934-14824/? D/LeakCanary﹕ In com.etiennelawlor.minesweeper:0.0.21:21.
* com.etiennelawlor.minesweeper.activities.MinesweeperActivity has leaked:
* GC ROOT com.google.android.gms.games.internal.GamesClientImpl$PopupLocationInfoBinderCallbacks.zzahO
* references com.google.android.gms.games.internal.PopupManager$PopupManagerHCMR1.zzajo
* references com.google.android.gms.games.internal.GamesClientImpl.mContext
* leaks com.etiennelawlor.minesweeper.activities.MinesweeperActivity instance
* Reference Key: f4d06830-0e16-43a2-9750-7e2cb77ae24d
* Device: LGE google Nexus 5 hammerhead
* Android Version: 5.1 API: 22
* Durations: watch=5016ms, gc=164ms, heap dump=3430ms, analysis=39535ms