canelmas / let

Annotation based simple API flavored with AOP to handle new Android runtime permission model
Apache License 2.0
530 stars 40 forks source link

Memory leak detected by LeakCanary #12

Open banasiak opened 8 years ago

banasiak commented 8 years ago

Hi,

When using this library, com.canelmas.let.DelayedTasks.tasks appears to leak an instance of the fragment that uses it. Below is a LeakCanary log. Please let me know if I can provide any additional information to help debug this issue.

Thanks!

In com.sample.android.debug:0.0.1:1.
* com.sample.android.ui.storelocator.StoreLocatorFragment has leaked:
* GC ROOT static com.canelmas.let.DelayedTasks.tasks
* references java.util.Collections$SynchronizedMap.m
* references java.util.HashMap.table
* references array java.util.HashMap$HashMapEntry[].[2]
* references java.util.HashMap$HashMapEntry.value
* references com.canelmas.let.DelayedTasks$Task.joinPoint
* references org.aspectj.runtime.reflect.JoinPointImpl._this
* leaks com.sample.android.ui.storelocator.StoreLocatorFragment instance

* Retaining: 0.92 KB.
* Reference Key: ecf51f74-d8fa-428e-9fbc-6779906aa8e6
* Device: Huawei google Nexus 6P angler
* Android Version: 6.0.1 API: 23 LeakCanary: 1.4-beta1 02804f3
* Durations: watch=5071ms, gc=181ms, heap dump=6489ms, analysis=58273ms

* Details:
* Class com.canelmas.let.DelayedTasks
|   static $staticOverhead = byte[8]@326231041 (0x1371e401)
|   static tasks = java.util.Collections$SynchronizedMap@326207008 (0x13718620)
* Instance of java.util.Collections$SynchronizedMap
|   static $staticOverhead = byte[8]@1874459337 (0x6fb9fac9)
|   static serialVersionUID = 1978198479659022715
|   m = java.util.HashMap@326184768 (0x13712f40)
|   mutex = java.util.Collections$SynchronizedMap@326207008 (0x13718620)
|   shadow$_klass_ = java.util.Collections$SynchronizedMap
|   shadow$_monitor_ = 0
* Instance of java.util.HashMap
|   static MINIMUM_CAPACITY = 4
|   static serialPersistentFields = java.io.ObjectStreamField[1]@1873718864 (0x6faeae50)
|   static EMPTY_TABLE = java.util.HashMap$HashMapEntry[2]@1873718408 (0x6faeac88)
|   static serialVersionUID = 362498820763181265
|   static $staticOverhead = byte[48]@1874489281 (0x6fba6fc1)
|   static MAXIMUM_CAPACITY = 1073741824
|   static DEFAULT_LOAD_FACTOR = 0.75
|   entryForNullKey = null
|   entrySet = null
|   keySet = null
|   modCount = 4
|   size = 2
|   table = java.util.HashMap$HashMapEntry[4]@326288640 (0x1372c500)
|   threshold = 3
|   values = null
|   keySet = null
|   valuesCollection = null
|   shadow$_klass_ = java.util.HashMap
|   shadow$_monitor_ = 0
* Array of java.util.HashMap$HashMapEntry[]
|   [0] = null
|   [1] = null
|   [2] = java.util.HashMap$HashMapEntry@329076224 (0x139d4e00)
|   [3] = null
* Instance of java.util.HashMap$HashMapEntry
|   hash = 1262722378
|   key = java.lang.Integer@1873706008 (0x6fae7c18)
|   next = java.util.HashMap$HashMapEntry@326288672 (0x1372c520)
|   value = com.canelmas.let.DelayedTasks$Task@329076192 (0x139d4de0)
|   shadow$_klass_ = java.util.HashMap$HashMapEntry
|   shadow$_monitor_ = 0
* Instance of com.canelmas.let.DelayedTasks$Task
|   joinPoint = org.aspectj.runtime.reflect.JoinPointImpl@329074624 (0x139d47c0)
|   permissionList = java.util.ArrayList@329076032 (0x139d4d40)
|   requestCode = 1
|   shadow$_klass_ = com.canelmas.let.DelayedTasks$Task
|   shadow$_monitor_ = 0
* Instance of org.aspectj.runtime.reflect.JoinPointImpl
|   _this = com.sample.android.ui.storelocator.StoreLocatorFragment@327039024 (0x137e3830)
|   arc = com.sample.android.ui.storelocator.StoreLocatorFragment$AjcClosure1@329074688 (0x139d4800)
|   args = java.lang.Object[0]@321742640 (0x132d6730)
|   staticPart = org.aspectj.runtime.reflect.JoinPointImpl$StaticPartImpl@322750176 (0x133cc6e0)
|   target = com.sample.android.ui.storelocator.StoreLocatorFragment@327039024 (0x137e3830)
|   shadow$_klass_ = org.aspectj.runtime.reflect.JoinPointImpl
|   shadow$_monitor_ = 0
* Instance of com.sample.android.ui.storelocator.StoreLocatorFragment
|   static PIN_LABELS = java.lang.String[5]@322750400 (0x133cc7c0)
|   static ajc$tjp_0 = org.aspectj.runtime.reflect.JoinPointImpl$StaticPartImpl@322750176 (0x133cc6e0)
|   static MAX_PINS_ON_MAP = 5
|   static $staticOverhead = byte[32]@320919553 (0x1320d801)
|   static $change = null
|   analytics = com.google.firebase.analytics.FirebaseAnalytics@319747056 (0x130ef3f0)
|   api = $Proxy0@315108288 (0x12c82bc0)
|   googleMap = com.google.android.gms.maps.GoogleMap@328919184 (0x139ae890)
|   locationName = java.lang.String@321788944 (0x132e1c10)
|   mapView = com.google.android.gms.maps.MapView@328363008 (0x13926c00)
|   searchBoxView = com.sample.android.ui.widget.FilterableSearchBoxView@328364032 (0x13927000)
|   subscriptions = rx.subscriptions.CompositeSubscription@326522400 (0x13765620)
|   view = android.support.percent.PercentRelativeLayout@328361984 (0x13926800)
|   unbinder = butterknife.Unbinder$1@321742608 (0x132d6710)
|   mAdded = false
|   mAllowEnterTransitionOverlap = null
|   mAllowReturnTransitionOverlap = null
|   mAnimatingAway = null
|   mArguments = null
|   mBackStackNesting = 0
|   mCalled = true
|   mCheckedForLoaderManager = false
|   mChildFragmentManager = null
|   mContainer = null
|   mContainerId = 0
|   mDeferStart = false
|   mDetached = false
|   mEnterTransition = null
|   mEnterTransitionCallback = null
|   mExitTransition = null
|   mExitTransitionCallback = null
|   mFragmentId = 0
|   mFragmentManager = null
|   mFromLayout = false
|   mHasMenu = false
|   mHidden = false
|   mHost = null
|   mInLayout = false
|   mIndex = -1
|   mInnerView = null
|   mLoaderManager = null
|   mLoadersStarted = false
|   mMenuVisible = true
|   mNextAnim = 0
|   mParentFragment = null
|   mReenterTransition = java.lang.Object@321742496 (0x132d66a0)
|   mRemoving = false
|   mRestored = false
|   mRetainInstance = false
|   mRetaining = false
|   mReturnTransition = java.lang.Object@321742496 (0x132d66a0)
|   mSavedFragmentState = null
|   mSavedViewState = android.util.SparseArray@321537568 (0x132a4620)
|   mSharedElementEnterTransition = null
|   mSharedElementReturnTransition = java.lang.Object@321742496 (0x132d66a0)
|   mState = 0
|   mStateAfterAnimating = 0
|   mTag = null
|   mTarget = null
|   mTargetIndex = -1
|   mTargetRequestCode = 0
|   mUserVisibleHint = true
|   mView = null
|   mWho = null
|   shadow$_klass_ = com.sample.android.ui.storelocator.StoreLocatorFragment
|   shadow$_monitor_ = 0
* Excluded Refs:
| Field: android.view.inputmethod.InputMethodManager.mNextServedView
| Field: android.view.inputmethod.InputMethodManager.mServedView
| Field: android.view.inputmethod.InputMethodManager.mServedInputConnection
| Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
| Thread:FinalizerWatchdogDaemon (always)
| Thread:main (always)
| Thread:LeakCanary-Heap-Dump (always)
| Class:java.lang.ref.WeakReference (always)
| Class:java.lang.ref.SoftReference (always)
| Class:java.lang.ref.PhantomReference (always)
| Class:java.lang.ref.Finalizer (always)
| Class:java.lang.ref.FinalizerReference (always)
| Root Class:android.os.Binder (always)
PiotrWpl commented 7 years ago

@canelmas any update on this?

canelmas commented 7 years ago

@PiotrWpl unfortunately not.

I'll definitely not be able to look into this in the next couple of weeks. Please feel free to contribute or make any suggestion.