AnyChart-Android
AnyChart-Android copied to clipboard
APIlib is leaking AnyChartView
This issue was found through StackOverflow.
Here's the leaktrace:
┬───
│ GC Root: System class
│
├─ com.anychart.APIlib class
│ Leaking: NO (a class is never leaking)
│ ↓ static APIlib.instance
│ ~~~~~~~~
├─ com.anychart.APIlib instance
│ Leaking: UNKNOWN
│ ↓ APIlib.anyChartView
│ ~~~~~~~~~~~~
├─ com.anychart.AnyChartView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ mContext instance of com.dreamakers.clustore.clustorestore.Activity.AnalyticsActivity with mDestroyed = true
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.any_chart_view
│ View.mWindowAttachCount = 1
│ ↓ AnyChartView.mContext
╰→ com.dreamakers.clustore.clustorestore.Activity.AnalyticsActivity instance
Leaking: YES (ObjectWatcher was watching this because com.dreamakers.clustore.clustorestore.Activity.AnalyticsActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
key = 7ac56641-d049-41a3-8cb8-0a2cae7cc320
watchDurationMillis = 8099
retainedDurationMillis = 3098
AnyChartView.init() passes the AnyChartView instance to APIlib.getInstance().setActiveAnyChartView(this); (source). APIlib is a singleton that is never cleared from memory, so it holds the AnyChartView forever, which in turns holds the activity context as well as the whole view hierarchy.
@pyricau Thank you for your report! We will take into account for future updates.