google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.97k stars 1.22k forks source link

Obsfucated class `fel` leaks Activity's context #966

Closed kevinbojarski closed 3 years ago

kevinbojarski commented 4 years ago

SPECIFIC ISSUE ENCOUNTERED

Memory leak detected by leak canary in arcore in solarsystem sample application (reproducible in other applications as well)

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. Add debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0' dependency to solarsystem example
  2. run application, and hit back button
  3. memory leak detected by leak canary

ADDITIONAL COMMENTS

Memory leak detected by leak canary: 2019-12-16 16:32:35.810 5417-5586/com.google.ar.sceneform.samples.solarsystem D/LeakCanary: ==================================== HEAP ANALYSIS RESULT

1 APPLICATION LEAKS

References underlined with "~~~" are likely causes.
Learn more at https://squ.re/leaks.

154624 bytes retained
┬
├─ dalvik.system.PathClassLoader
│    Leaking: NO (Object[]↓ is not leaking and A ClassLoader is never leaking)
│    GC Root: Global variable in native code
│    ↓ PathClassLoader.runtimeInternalObjects
├─ java.lang.Object[]
│    Leaking: NO (fel↓ is not leaking)
│    ↓ array Object[].[246]
├─ fel
│    Leaking: NO (a class is never leaking)
│    ↓ static fel.a
│                 ~
├─ fel
│    Leaking: YES (fel wraps an Activity with Activity.mDestroyed true)
│    ↓ fel.mBase
╰→ com.google.ar.sceneform.samples.solarsystem.SolarActivity
​     Leaking: YES (fel↑ is leaking and Activity#mDestroyed is true and ObjectWatcher was watching this)
​     key = 45574c63-a377-493a-8a4f-8d577d46c4f2
​     watchDurationMillis = 5121
​     retainedDurationMillis = 120
====================================
0 LIBRARY LEAKS

Leaks coming from the Android Framework or Google libraries.
====================================
METADATA

Please include this in bug reports and Stack Overflow questions.

Build.VERSION.SDK_INT: 27
Build.MANUFACTURER: Google
LeakCanary version: 2.0
App process name: com.google.ar.sceneform.samples.solarsystem
Analysis duration: 2994 ms
Heap dump file path: /data/user/0/com.google.ar.sceneform.samples.solarsystem/files/leakcanary/2019-12-16_16-32-32_026.hprof
Heap dump timestamp: 1576531955809
====================================
Sheng-Xuan commented 4 years ago

Having the same issue, but in my case the obfuscated name is 'fby'

triplesky commented 3 years ago

Has anyone solved this problem?this appear in hell_ar_java ,helloscenform demo,in my case name is 'fsb' @devbridie

devbridie commented 3 years ago

The problem should be solved in latest ARCore versions. Please make sure your ARCore SDK version is recent. If you're still seeing this, let me know.