I am using Leak Canary to track memory leak and it says the following were leaked:
static hk.o
references ht.a
leaks MainActivity instance
what is the hk.o
and ht.a
? I dont have them in my MainActivity.
This is what the Android documentation recommends. Disable the leakcanary launcher activity by setting the leak_canary_add_launcher_icon resource boolean to false.
LeakCanary hooks into the Android lifecycle to automatically detect when activities and fragments are destroyed and should be garbage collected. These destroyed objects are passed to an ObjectWatcher , which holds weak references to them.
LeakCanary 🐤 LeakCanary is a memory leak detection library for Android. LeakCanary's knowledge of the internals of the Android Framework gives it a unique ability to narrow down the cause of each leak, helping developers dramatically reduce Application Not Responding freezes and OutOfMemoryError crashes.
A root leak can be one of two things. It can be a single memory leak, or it can be the start of a leak cycle. A leak cycle occurs when you lose a reference to a group of objects. A memory leak leaks one object while a leak cycle leaks a group of objects.
Those classes are third party library classes . You may take your MainActivity instance as an argument and pass in which class's instance belong to library. You could use ApplicationContext as an argument if it's not necessary to pass in Activity.
I think those are pro guarded (renamed classes with random names to prevent reverse engineering) of any one of the dependencies. I have seen this when stuff related like Google Sign In is used in the app.
Google Services classes are generally Pro Guarded.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With