Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内存溢出 #2

Open
ChrisWuAnHui opened this issue Apr 19, 2023 · 1 comment
Open

内存溢出 #2

ChrisWuAnHui opened this issue Apr 19, 2023 · 1 comment

Comments

@ChrisWuAnHui
Copy link

使用demo,添加了leakcanary

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'

发现有内存泄漏

@ChrisWuAnHui
Copy link
Author

====================================
HEAP ANALYSIS RESULT
====================================
1 APPLICATION LEAKS

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

5711226 bytes retained by leaking objects
Signature: 9c011792c1fee2068e51f4f6c021dbe8acafbbd3
┬───
│ GC Root: Global variable in native code
│
├─ com.huawei.openalliance.ad.ipc.g$a$1 instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2186 objects
│    Anonymous subclass of com.huawei.openalliance.ad.ipc.e$a
│    ↓ g$a$1.V
│            ~
├─ com.huawei.openalliance.ad.ipc.g$a instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2185 objects
│    ↓ g$a.I
│          ~
├─ com.huawei.hms.ads.jz$a instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2182 objects
│    V instance of com.huawei.hms.ads.sdk.AdSampleApplication
│    ↓ jz$a.Code
│           ~~~~
├─ com.huawei.hms.ads.gi$3$1 instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2181 objects
│    Anonymous class implementing com.huawei.openalliance.ad.ipc.RemoteCallResultCallback
│    ↓ gi$3$1.Code
│             ~~~~
├─ com.huawei.hms.ads.gi$3 instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2180 objects
│    Anonymous class implementing java.lang.Runnable
│    ↓ gi$3.I
│           ~
├─ com.huawei.hms.ads.gl instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2174 objects
│    ↓ gi.g
│         ~
├─ com.huawei.hms.ads.sdk.SplashActivity$splashAdLoadListener$1 instance
│    Leaking: UNKNOWN
│    Retaining 5.7 MB in 2081 objects
│    Anonymous subclass of com.huawei.hms.ads.splash.SplashView$SplashAdLoadListener
│    this$0 instance of com.huawei.hms.ads.sdk.SplashActivity with mDestroyed = true
│    ↓ SplashActivity$splashAdLoadListener$1.this$0
│                                            ~~~~~~
╰→ com.huawei.hms.ads.sdk.SplashActivity instance
​     Leaking: YES (ObjectWatcher was watching this because com.huawei.hms.ads.sdk.SplashActivity received
​     Activity#onDestroy() callback and Activity#mDestroyed is true)
​     Retaining 5.7 MB in 2080 objects
​     key = 2e68a336-f5b1-45ba-a8c0-c87c8c611538
​     watchDurationMillis = 215568
​     retainedDurationMillis = 210566
​     mApplication instance of com.huawei.hms.ads.sdk.AdSampleApplication
​     mBase instance of android.app.ContextImpl
====================================
0 LIBRARY LEAKS

A Library Leak is a leak caused by a known bug in 3rd party code that you do not have control over.
See https://square.github.io/leakcanary/fundamentals-how-leakcanary-works/#4-categorizing-leaks
====================================
0 UNREACHABLE OBJECTS

An unreachable object is still in memory but LeakCanary could not find a strong reference path
from GC roots.
====================================
METADATA

Please include this in bug reports and Stack Overflow questions.

Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: HUAWEI
LeakCanary version: 2.10
App process name: com.huawei.hms.ads.sdk
Class count: 13953
Instance count: 108441
Primitive array count: 82102
Object array count: 12306
Thread count: 23
Heap total bytes: 15318684
Bitmap count: 11
Bitmap total bytes: 5591915
Large bitmap count: 0
Large bitmap total bytes: 0
Stats: LruCache[maxSize=3000,hits=29626,misses=61116,hitRate=32%]
RandomAccess[bytes=3209214,reads=61116,travel=23344640116,range=18536222,size=23579980]
Heap dump reason: user request
Analysis duration: 3424 ms
Heap dump file path: /data/user/0/com.huawei.hms.ads.sdk/cache/leakcanary/2023-04-19_15-18-14_087.hprof
Heap dump timestamp: 1681888699846
Heap dump duration: 1153 ms
====================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant