Skip to content

What should we do about unreachable objects in heap analysis result? #2793

@CoderGautam07

Description

@CoderGautam07

I was trying to find memory leaks in my app using leak canary and as i was using the app i saw notification that more than 5 retained objects were found and head dump started but after it completed it said 0 retained objects but around 6 unreachable objects. Sometime even more or sometimes less. Now i am confused should i look into those unreachable objects or they are not any leaks and i should ignore them? I wanted an urgent resolution to my query thats why posted here Sorry!
Here's the head dump report
HEAP ANALYSIS RESULT

0 APPLICATION LEAKS

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

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

6 UNREACHABLE OBJECTS

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

com.magicpin.local.screenwallet.WalletHomeFragment instance
​ Leaking: YES (ObjectWatcher was watching this because com.magicpin.local.screenwallet.WalletHomeFragment received
​ Fragment#onDestroy() callback. Conflicts with Fragment.mLifecycleRegistry.state is INITIALIZED)
​ key = fe56606a-9c18-44f6-9d24-1b0ff898b502
​ watchDurationMillis = 5784
​ retainedDurationMillis = 654
​ actionListener instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false
​ fragmentContext instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false
​ activity instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false
​ dataFetchedCallback instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false

com.magicpin.local.screensearchnew.viewmodel.SearchResultViewModel instance
​ Leaking: YES (ObjectWatcher was watching this because com.magicpin.local.screensearchnew.viewmodel.
​ SearchResultViewModel received ViewModel#onCleared() callback)
​ key = 4f43546b-b0b9-4244-94a8-f28dd75758de
​ watchDurationMillis = 5785
​ retainedDurationMillis = 664

com.magicpin.local.screenwallet.DiscoveryViewModel instance
​ Leaking: YES (ObjectWatcher was watching this because com.magicpin.local.screenwallet.DiscoveryViewModel received
​ ViewModel#onCleared() callback)
​ key = f2886c35-3942-49d7-bea2-3e33dbfdff3f
​ watchDurationMillis = 5785
​ retainedDurationMillis = 664

com.magicpin.local.screenwallet.WalletHomeFragment instance
​ Leaking: YES (ObjectWatcher was watching this because com.magicpin.local.screenwallet.WalletHomeFragment received
​ Fragment#onDestroy() callback. Conflicts with Fragment.mLifecycleRegistry.state is INITIALIZED)
​ key = 723bd07a-df32-4f38-b807-ef1f2dc6a149
​ watchDurationMillis = 5901
​ retainedDurationMillis = 848
​ actionListener instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false
​ fragmentContext instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false
​ activity instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false
​ dataFetchedCallback instance of com.magicpin.local.screencategory.CategoryActivity with mDestroyed = false

com.magicpin.local.screensearchnew.viewmodel.SearchResultViewModel instance
​ Leaking: YES (ObjectWatcher was watching this because com.magicpin.local.screensearchnew.viewmodel.
​ SearchResultViewModel received ViewModel#onCleared() callback)
​ key = 4d16cf95-2a88-4ab9-833e-377177e5e6b7
​ watchDurationMillis = 5902
​ retainedDurationMillis = 848

com.magicpin.local.screenwallet.DiscoveryViewModel instance
​ Leaking: YES (ObjectWatcher was watching this because com.magicpin.local.screenwallet.DiscoveryViewModel received
​ ViewModel#onCleared() callback)
​ key = 4b63c9a1-60aa-41db-a471-a311b859ff2a
​ watchDurationMillis = 5902
​ retainedDurationMillis = 848

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions