381 questions
0 votes
1 answer
87 views
How to log memory leaks using a custom logger? [closed]
I started using LeakCanary in my app. Based on various sources, I found that with this dependency: debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14' LeakCanary watches the ...
1 vote
0 answers
58 views
Fragment leaked by androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation
I have Navigation Component (version 2.9.0) with androidx Fragments (version 1.8.6) and Predictive Back and androidx.transitions (version 1.6.0) with gesture navigation enabled. I'm seeing this leak ...
0 votes
0 answers
102 views
How to fix memory leak caused by ViewModel delegate?
LeakCanary's logs show that after ViewModel.onClear() the pageModelPagingDataFlow does not release memory. Update 1 I found that the memory leak would be fixed if change by activityViewModels() to by ...
1 vote
0 answers
137 views
Memory leak WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper in InputMethodService onDestroy() Android 14 (34 Api)
I implemented a custom software keyboard using Compose to build the UI part and InputMethodService() for IME function interaction. It works as expected. However, memory leak ...
0 votes
0 answers
272 views
AutofillClientController leaking activity: system leak or is it my implementation?
When rotating the emulator the memory leak below pops up. I'm not able to figure out exactly where it comes from. To me it looks like the systems AutofillClientController is leaking my ExampleActivity....
3 votes
0 answers
114 views
Detecting multiple instances of a custom object via LeakCanary
As per the docs, looks like LeakCanary only provides information about leaked object. But, I am also interested in finding multiple instances of certain custom HeavyWeightObject objects. Can ...
1 vote
2 answers
4k views
I'm getting a native crash in my application. This crash is frequent in the release build and has never occurred in debug
I tried looking into the systrace in Perfetto UI but just couldn't figure out the reason for crash. The logs for the crashes showed multiple calls related to the G.C so suspected it to be a memory ...
0 votes
0 answers
140 views
Can we identify the line number responsible for memory leaks in an Android app?
I'm trying to find the line number causing a memory leak in an Android app. Is there a way to pinpoint the exact line? I have tried using LeakCanary library to find the memory leaks in the Android app....
1 vote
1 answer
668 views
ComposeView leak: ViewTreeObserver.OnGlobalLayoutListener leaking even if it is removed during onDispose
So I have this Composable that I use to detect if a keyboard is visible: @Composable fun keyboardVisibilityAsState(): State<Boolean> { val keyboardState = remember { mutableStateOf(false) } ...
0 votes
0 answers
462 views
How to figure out where canary and return address are located?
I have this code gave me from my professor, he also wrote other versions of the same software going to uncomment parts of code in order to show us how a stack works but I don't really understand. #...
1 vote
3 answers
1k views
ConnectivityManager Callback Memory Leak - Android
I'm using LeakCanary and it found a memory leak in ConnectivityManager. I've never used ConnectivityManager before and it's not in my project from anything that I wrote. I'm assuming maybe a 3rd party ...
0 votes
0 answers
30 views
Custom back press handler causes mem leak
have registered custom back press with handler onCreate in fragment. But leak canary tells there is memory leak when the fragment gets destroyed. This is on back press implementation called on ...
0 votes
1 answer
2k views
received Activity#onDestroy() callback and Activity#mDestroyed is true - Android
How can I resolve this leak? ┬─── │ GC Root: Global variable in native code │ ├─ com.samsung.android.content.clipboard.SemClipboardManager$2 instance │ Leaking: UNKNOWN │ Retaining 204.4 kB in ...
1 vote
1 answer
490 views
Activity with Navigation component cause A Memory Leak after Start New Root Activity or Calling Finish()
My app start with this Activity _ A _ Which has FragmentContainer that get initialized as following <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/...
2 votes
1 answer
1k views
Android - Leakcanary spot memory leak in Activities using Android webview - Problem identified in Samsung Android 13 (One ui 5)
folks Using leakcanary tool we have noticed recently memory leaks in activities that use webview. The issue just occurs in some models like Samsung devices with Android 13 (one ui 5). We were not able ...