https://kotlinlang.org logo
Title
n

Nat Strangerweather

07/17/2022, 2:29 PM
I was wondering if someone might be able to help me understand why I am getting a leak. As far as I can see, it is caused by my Material3 DropDownMenu. More in thread...
Here is the report:
┬───
│ GC Root: Input or output parameters in native code
│
├─ dalvik.system.PathClassLoader instance
│    Leaking: NO (InternalLeakCanary↓ is not leaking and A ClassLoader is never
│    leaking)
│    ↓ ClassLoader.runtimeInternalObjects
├─ java.lang.Object[] array
│    Leaking: NO (InternalLeakCanary↓ is not leaking)
│    ↓ Object[758]
├─ leakcanary.internal.InternalLeakCanary class
│    Leaking: NO (MainActivity↓ is not leaking and a class is never leaking)
│    ↓ static InternalLeakCanary.resumedActivity
├─ com.strangerweather.words.MainActivity instance
│    Leaking: NO (LifecycleRegistry↓ is not leaking and Activity#mDestroyed is
│    false)
│    mApplication instance of com.strangerweather.words.WordApp
│    mBase instance of android.app.ContextImpl
│    ↓ ComponentActivity.mLifecycleRegistry
├─ androidx.lifecycle.LifecycleRegistry instance
│    Leaking: NO (AndroidComposeView↓ is not leaking and mState is not
│    DESTROYED)
│    mState = RESUMED
│    ↓ LifecycleRegistry.mObserverMap
├─ androidx.arch.core.internal.FastSafeIterableMap instance
│    Leaking: NO (AndroidComposeView↓ is not leaking)
│    ↓ FastSafeIterableMap[key()]
├─ androidx.compose.ui.platform.AndroidComposeView instance
│    Leaking: NO (View attached)
│    View is part of a window view hierarchy
│    View.mAttachInfo is not null (view attached)
│    View.mWindowAttachCount = 1
│    mContext instance of com.strangerweather.words.MainActivity with
│    mDestroyed = false
│    ↓ AndroidComposeView.accessibilityDelegate
│                         ~~~~~~~~~~~~~~~~~~~~~
├─ androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat
│  instance
│    Leaking: UNKNOWN
│    Retaining 1.6 MB in 28134 objects
│    ↓ AndroidComposeViewAccessibilityDelegateCompat.currentSemanticsNodes
│                                                    ~~~~~~~~~~~~~~~~~~~~~
├─ java.util.LinkedHashMap instance
│    Leaking: UNKNOWN
│    Retaining 1.6 MB in 28110 objects
│    ↓ LinkedHashMap[instance @319567136 of java.lang.Integer]
│                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ androidx.compose.ui.platform.SemanticsNodeWithAdjustedBounds instance
│    Leaking: UNKNOWN
│    Retaining 40 B in 2 objects
│    ↓ SemanticsNodeWithAdjustedBounds.semanticsNode
│                                      ~~~~~~~~~~~~~
├─ androidx.compose.ui.semantics.SemanticsNode instance
│    Leaking: UNKNOWN
│    Retaining 375 B in 15 objects
│    ↓ SemanticsNode.layoutNode
│                    ~~~~~~~~~~
├─ androidx.compose.ui.node.LayoutNode instance
│    Leaking: UNKNOWN
│    Retaining 3.5 kB in 122 objects
│    ↓ LayoutNode._foldedParent
│                 ~~~~~~~~~~~~~
├─ androidx.compose.ui.node.LayoutNode instance
│    Leaking: UNKNOWN
│    Retaining 261.8 kB in 3575 objects
│    ↓ LayoutNode._foldedChildren
│                 ~~~~~~~~~~~~~~~
├─ androidx.compose.runtime.collection.MutableVector instance
│    Leaking: UNKNOWN
│    Retaining 84 B in 2 objects
│    ↓ MutableVector.content
│                    ~~~~~~~
├─ androidx.compose.ui.node.LayoutNode[] array
│    Leaking: UNKNOWN
│    Retaining 64 B in 1 objects
│    ↓ LayoutNode[2]
│                ~~~
├─ androidx.compose.ui.node.LayoutNode instance
│    Leaking: UNKNOWN
│    Retaining 260.6 kB in 3546 objects
│    ↓ LayoutNode.measurePolicy
│                 ~~~~~~~~~~~~~
├─ androidx.compose.ui.window.AndroidPopup_androidKt$Popup$8 instance
│    Leaking: UNKNOWN
│    Retaining 16 B in 1 objects
│    Anonymous class implementing androidx.compose.ui.layout.MeasurePolicy
│    ↓ AndroidPopup_androidKt$Popup$8.$popupLayout
│                                     ~~~~~~~~~~~~
╰→ androidx.compose.ui.window.PopupLayout instance
     Leaking: YES (ObjectWatcher was watching this because androidx.compose.ui.
     window.PopupLayout received View#onDetachedFromWindow() callback)
     Retaining 259.7 kB in 3520 objects
     key = 717e8b81-3f07-4184-8a55-5a76ccd5d49c
     watchDurationMillis = 653354
     retainedDurationMillis = 648353
     View not part of a window view hierarchy
     View.mAttachInfo is null (view detached)
     View.mID = R.id.null
     View.mWindowAttachCount = 1
     mContext instance of com.strangerweather.words.MainActivity with
     mDestroyed = false

METADATA

Build.VERSION.SDK_INT: 32
Build.MANUFACTURER: Google
LeakCanary version: 2.9.1
App process name: com.strangerweather.words
Class count: 24160
Instance count: 277892
Primitive array count: 144929
Object array count: 35348
Thread count: 43
Heap total bytes: 29363520
Bitmap count: 13
Bitmap total bytes: 366925
Large bitmap count: 0
Large bitmap total bytes: 0
Db 1: open /data/user/0/com.strangerweather.words/databases/word_database
Stats: LruCache[maxSize=3000,hits=119113,misses=264375,hitRate=31%]
RandomAccess[bytes=13380275,reads=264375,travel=70399457635,range=35566999,size=
43926117]
Analysis duration: 8784 ms
And this is my DropDownMenu code:
var showMenu by remember { mutableStateOf(false) }

                   DropdownMenu(
                        expanded = showMenu,
                        onDismissRequest = { showMenu = false }
                    ) {
                        DropdownMenuItem(text = { Text(text = "Stats") }, leadingIcon = {
                            Icon(
                                imageVector = Icons.Filled.Score,
                                contentDescription = "Score Icon"
                            )
                        }, onClick = {
                            navigator.navigate(StatsPageDestination)
                        })
                        DropdownMenuItem(text = { Text(text = "Themes") }, leadingIcon = {
                            Icon(
                                imageVector = Icons.Filled.Palette,
                                contentDescription = "Palette Icon"
                            )
                        }, onClick = {
                            navigator.navigate(ThemingPageDestination)
                        })
                        DropdownMenuItem(text = { Text(text = "History") }, leadingIcon = {
                            Icon(
                                imageVector = Icons.Filled.History,
                                contentDescription = "History Icon"
                            )
                        }, onClick = {
                            navigator.navigate(HistoryPageDestination)
                        })
                    }
Just bumping this, as the weekend was very quiet on Slack. Hope you guys don't mind too much...
a

Alex Vanyo

07/18/2022, 6:41 PM
It looks like that might be the same issue as https://issuetracker.google.com/issues/206177594
n

Nat Strangerweather

07/18/2022, 6:43 PM
Ah yes, it looks like it. What's the situation regarding a fix?
a

Alex Vanyo

07/18/2022, 10:43 PM
It’s being tracked, but no estimate on when it’ll be fixed
👍 1