Skip to content

[android] Clipboard manager leak on TorLogsViewModel

🐞 Bug Report

┬───
│ GC Root: Global variable in native code

├─ android.content.ClipboardManager$1 instance
│    Leaking: UNKNOWN
│    Retaining 544 B in 1 objects
│    Anonymous subclass of android.content.IOnPrimaryClipChangedListener$Stub
│    ↓ ClipboardManager$1.this$0
│                         ~~~~~~
├─ android.content.ClipboardManager instance
│    Leaking: UNKNOWN
│    Retaining 2.8 kB in 89 objects
│    mContext instance of android.app.ContextImpl
│    ↓ ClipboardManager.mPrimaryClipChangedListeners
│                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ java.util.ArrayList instance
│    Leaking: UNKNOWN
│    Retaining 2.7 kB in 87 objects
│    ↓ ArrayList[1]
│               ~~~
├─ org.mozilla.fenix.tor.TorLogsViewModel$$ExternalSyntheticLambda0 instance
│    Leaking: UNKNOWN
│    Retaining 1.0 kB in 33 objects
│    ↓ TorLogsViewModel$$ExternalSyntheticLambda0.f$0
│                                                 ~~~
╰→ org.mozilla.fenix.tor.TorLogsViewModel instance
​     Leaking: YES (ObjectWatcher was watching this because org.mozilla.fenix.
​     tor.TorLogsViewModel received ViewModel#onCleared() callback)
​     Retaining 1.0 kB in 32 objects
​     key = 8db344b7-94b4-4d7e-9e12-c3b8edb35305
​     watchDurationMillis = 62738
​     retainedDurationMillis = 57737
​     application instance of org.mozilla.fenix.DebugFenixApplication

METADATA

Build.VERSION.SDK_INT: 36
Build.MANUFACTURER: Google
LeakCanary version: 2.14
App process name: org.torproject.torbrowser_debug
Class count: 47000
Instance count: 277416
Primitive array count: 206417
Object array count: 43412
Thread count: 54
Heap total bytes: 40509854
Bitmap count: 47
Bitmap total bytes: 1026159
Large bitmap count: 0
Large bitmap total bytes: 0
Db 1: open /data/user/0/org.torproject.
torbrowser_debug/databases/recently_closed_tabs
Db 2: open /data/user/0/org.torproject.torbrowser_debug/no_backup/androidx.work.
workdb
Db 3: open /data/user/0/org.torproject.
torbrowser_debug/databases/mozac_downloads_database
Db 4: open /data/user/0/org.torproject.torbrowser_debug/databases/crashes
Db 5: open /data/user/0/org.torproject.torbrowser_debug/databases/manifests
Db 6: open /data/user/0/org.torproject.
torbrowser_debug/databases/tab_collections
Db 7: open /data/user/0/org.torproject.torbrowser_debug/databases/top_sites
Stats: LruCache[maxSize=3000,hits=130601,misses=252020,hitRate=34%]
RandomAccess[bytes=12636237,reads=252020,travel=130760301023,range=49289561,size
=60857946]
Analysis duration: 6693 ms

Reproduction steps

Launch app, open logs, and close them. When in debug mode, LeakCanary should notify you that there is a leak.

Bookkeeping

  • Browser version:
  • Browser channel:
    • Release
    • Alpha
    • Nightly
  • Distribution method:
    • Installer/archive from torproject.org
    • tor-browser-launcher
    • homebrew
    • other (please specify):
  • Operating System:
    • Windows
    • macOS
    • Linux
    • Android
    • Tails
    • Other (please specify):
  • Operating System Version:

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information