[Blankj/AndroidUtilCode]内存泄漏

2024-07-15 99 views
6
描述 Bug

简洁地描述下 Bug。

  • AndroidUtilCode 的版本:utilcodex:1.30.5
  • 出现 Bug 的设备型号:OnePlus 7 Pro
  • 设备的 Android 版本:API29

leak

回答

2

┬─── │ GC Root: Input or output parameters in native code │ ├─ android.os.FileObserver$ObserverThread instance │ Leaking: NO (PathClassLoader↓ is not leaking) │ Thread name: 'FileObserver' │ ↓ Thread.contextClassLoader ├─ dalvik.system.PathClassLoader instance │ Leaking: NO (ToastUtils↓ is not leaking and A ClassLoader is never leaking) │ ↓ ClassLoader.runtimeInternalObjects ├─ java.lang.Object[] array │ Leaking: NO (ToastUtils↓ is not leaking) │ ↓ Object[].[3995] ├─ com.blankj.utilcode.util.ToastUtils class │ Leaking: NO (a class is never leaking) │ ↓ static ToastUtils.iToast │ ~~ ├─ com.blankj.utilcode.util.ToastUtils$SystemToast instance │ Leaking: UNKNOWN │ Retaining 10.0 kB in 120 objects │ ↓ ToastUtils$AbsToast.mToastView │ ~~ ╰→ com.blankj.utilcode.util.ToastUtils$UtilsMaxWidthRelativeLayout instance ​ Leaking: YES (ObjectWatcher was watching this because com.blankj.utilcode. ​ util.ToastUtils$UtilsMaxWidthRelativeLayout received ​ View#onDetachedFromWindow() callback) ​ Retaining 8.1 kB in 113 objects ​ key = 45445c73-b008-44dc-85f1-5b66df66fabf ​ watchDurationMillis = 105320 ​ retainedDurationMillis = 100305 ​ View not part of a window view hierarchy ​ View.mAttachInfo is null (view detached) ​ View.mWindowAttachCount = 1 ​ mContext instance of top.kxxg.lvcha.base.ChaApp

METADATA

Build.VERSION.SDK_INT: 29 Build.MANUFACTURER: OnePlus LeakCanary version: 2.6 App process name: top.kxxg.lvcha Stats: LruCache[maxSize=3000,hits=10859,misses=149066,hitRate=6%] RandomAccess[bytes=8919678,reads=149066,travel=69585202550,range=31230583,size=3 7538941] Heap dump reason: 5 retained objects, app is visible Analysis duration: 6142 ms

5

我也是这个问题 手机Redmi Note 7

4
  • I have occured the same error.
┬───
    │ GC Root: Input or output parameters in native code
    │
    ├─ android.os.FileObserver$ObserverThread instance
    │    Leaking: NO (PathClassLoader↓ is not leaking)
    │    Thread name: 'FileObserver'
    │    ↓ Thread.contextClassLoader
    ├─ dalvik.system.PathClassLoader instance
    │    Leaking: NO (ToastUtils↓ is not leaking and A ClassLoader is never leaking)
    │    ↓ ClassLoader.runtimeInternalObjects
    ├─ java.lang.Object[] array
    │    Leaking: NO (ToastUtils↓ is not leaking)
    │    ↓ Object[].[375]
    ├─ com.blankj.utilcode.util.ToastUtils class
    │    Leaking: NO (a class is never leaking)
    │    ↓ static ToastUtils.iToast
    │                        ~~~~~~
    ├─ com.blankj.utilcode.util.ToastUtils$SystemToast instance
    │    Leaking: UNKNOWN
    │    Retaining 491.4 kB in 55 objects
    │    ↓ ToastUtils$AbsToast.mToast
    │                          ~~~~~~
    ├─ android.widget.Toast instance
    │    Leaking: UNKNOWN
    │    Retaining 491.4 kB in 54 objects
    │    mContext instance of com.blackshark.bsamagent.DebugApp
    │    ↓ Toast.mNextView
    │            ~~~~~~~~~
    ╰→ android.widget.LinearLayout instance
    ​     Leaking: YES (ObjectWatcher was watching this because android.widget.LinearLayout received
    ​     View#onDetachedFromWindow() callback)
    ​     Retaining 491.4 kB in 52 objects
    ​     key = 9f860948-f068-42d9-9ddf-8fe2f27b6089
    ​     watchDurationMillis = 8114
    ​     retainedDurationMillis = 3077
    ​     View not part of a window view hierarchy
    ​     View.mAttachInfo is null (view detached)
    ​     View.mWindowAttachCount = 1
    ​     mContext instance of com.blackshark.bsamagent.DebugApp

    METADATA
4

1.30.6 版本已修复

8

1.30.6 版本已修复

这个问题为啥会产生,大神能解答一下疑惑么。最近使用bugly他也有这个问题。但是使用的是applicationContext啊。有点疑惑。谢谢。