deva666 / Peko

Android Library for requesting Permissions with Kotlin Flow
Apache License 2.0
152 stars 10 forks source link

Memory leak due to permissionsToRequesterMap #27

Closed shahid17june closed 10 months ago

shahid17june commented 1 year ago

1 APPLICATION LEAKS

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

                                                                                                27195 bytes retained by leaking objects
                                                                                                Signature: 66b567888a8bb4f1c35748db60004e7939645c28
                                                                                                ┬───
                                                                                                │ GC Root: System class
                                                                                                │
                                                                                                ├─ com.markodevcic.peko.PekoActivity class
                                                                                                │    Leaking: NO (a class is never leaking)
                                                                                                │    ↓ static PekoActivity.permissionsToRequesterMap
                                                                                                │                          ~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                ├─ java.util.concurrent.ConcurrentHashMap instance
                                                                                                │    Leaking: UNKNOWN
                                                                                                │    Retaining 27.4 kB in 462 objects
                                                                                                │    ↓ ConcurrentHashMap[""]
                                                                                                │                       ~~~~
                                                                                                ├─ kotlinx.coroutines.CompletableDeferredImpl instance
                                                                                                │    Leaking: UNKNOWN
                                                                                                │    Retaining 27.2 kB in 459 objects
                                                                                                │    _state instance of com.markodevcic.peko.PekoActivity with mDestroyed = true
                                                                                                │    ↓ JobSupport._state
                                                                                                │                 ~~~~~~
                                                                                                ╰→ com.markodevcic.peko.PekoActivity instance
                                                                                                ​     Leaking: YES (ObjectWatcher was watching this because com.markodevcic.peko.PekoActivity received
                                                                                                ​     Activity#onDestroy() callback and Activity#mDestroyed is true)
                                                                                                ​     Retaining 27.2 kB in 458 objects
                                                                                                ​     key = acd6b2f5-6570-44f8-9eee-86be9a99681f
                                                                                                ​     watchDurationMillis = 5862
                                                                                                ​     retainedDurationMillis = 862
                                                                                                ​     mApplication instance of com.nadi.demo.application.ChatApplication
                                                                                                ​     mBase instance of android.app.ContextImpl
deva666 commented 1 year ago

Thanks for reporting this, looking into it.

deva666 commented 11 months ago

Sorry for the late reply and thanks again for reporting it. Fixed with https://github.com/deva666/Peko/commit/2d20a0388be07f2489acdb8237a6df8c4383c766 New release is on the way