FolioReader-Android icon indicating copy to clipboard operation
FolioReader-Android copied to clipboard

Memory leak in TextToSpeech activity

Open animesh-sharama opened this issue 4 years ago • 0 comments

Issue / Feature - Memory leak in TextToSpeech activity FolioReader version - 0.5.4 FolioReader Stock / Modified - Stock Android SDK - 29, 30 Mobile / Tablet / Emulator Info - Samsung Galaxy S20, Google pixel 2, One Plus 8 Crash / Error -

        ┬───
        │ GC Root: Global variable in native code
        │
        ├─ android.speech.tts.TextToSpeech$Connection$1 instance
        │    Leaking: UNKNOWN
        │    Anonymous subclass of android.speech.tts.ITextToSpeechCallback$Stub
        │    ↓ TextToSpeech$Connection$1.this$1
        │                                ~~~~~~
        ├─ android.speech.tts.TextToSpeech$Connection instance
        │    Leaking: UNKNOWN
        │    ↓ TextToSpeech$Connection.this$0
        │                              ~~~~~~
        ├─ android.speech.tts.TextToSpeech instance
        │    Leaking: UNKNOWN
        │    ↓ TextToSpeech.mUtteranceProgressListener
        │                   ~~~~~~~~~~~~~~~~~~~~~~~~~~
        ├─ android.speech.tts.UtteranceProgressListener$1 instance
        │    Leaking: UNKNOWN
        │    Anonymous subclass of android.speech.tts.UtteranceProgressListener
        │    ↓ UtteranceProgressListener$1.val$listener
        │                                  ~~~~~~~~~~~~
        ├─ com.folioreader.mediaoverlay.MediaController$2$1 instance
        │    Leaking: UNKNOWN
        │    Anonymous class implementing android.speech.tts.TextToSpeech$OnUtteranceCompletedListener
        │    ↓ MediaController$2$1.this$1
        │                          ~~~~~~
        ├─ com.folioreader.mediaoverlay.MediaController$2 instance
        │    Leaking: UNKNOWN
        │    Anonymous class implementing android.speech.tts.TextToSpeech$OnInitListener
        │    ↓ MediaController$2.this$0
        │                        ~~~~~~
        ├─ com.folioreader.mediaoverlay.MediaController instance
        │    Leaking: UNKNOWN
        │    ↓ MediaController.callbacks
        │                      ~~~~~~~~~
        ╰→ com.folioreader.ui.fragment.FolioPageFragment instance
        ​     Leaking: YES (ObjectWatcher was watching this because com.folioreader.ui.fragment.FolioPageFragment received Fragment#onDestroy() callback and Fragment#mFragmentManager is null)
        ​     key = 7ecef8b1-4e81-49ec-9fc7-8e862fe57bc9
        ​     watchDurationMillis = 24842
        ​     retainedDurationMillis = 19837
         
        METADATA
         
        Build.VERSION.SDK_INT: 30
        Build.MANUFACTURER: Google
        LeakCanary version: 2.4
        App process name: com.example.testandroid
        Analysis duration: 15000 ms

Steps to reproduce / Describe in detail -

  • Add leak canary into the app created by android sample: var objectWatcher: ObjectWatcher = AppWatcher.objectWatcher private set using com.squareup.leakcanary:leakcanary-android:2.4 and com.squareup.leakcanary:leakcanary-object-watcher-android2.4
  • Read book from raw resource inside activity
val folioReader = FolioReader.get()
folioReader.openBook(R.raw.test)

animesh-sharama avatar Oct 06 '20 11:10 animesh-sharama