17

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.

Nicolas
  • 291
  • 1
  • 7
  • I have the same issue, probably something related to the google play services library. – meh May 09 '17 at 12:26
  • 1
    Those class names are obfuscated and could be anything. There's a Share Info button in the menu of Leaks, post the whole output here. – Eugen Pechanec May 13 '17 at 19:04

3 Answers3

3

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.

Abhishek
  • 61
  • 7
3

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.

Cyrus
  • 8,995
  • 9
  • 31
  • 58
1

I tracked this down, and the culprit is Google Ads. The classes you mentioned are actually from the library com.google.ads.interactivemedia.v3:interactivemedia, which is included with play-services-ads.

The reference to the activity was set via the constructor of PublisherAdView, where I passed the activity context. Probably you are also using a similar ad view in your app.

As a workaround, I now pass the application context to the ad view, which seems to have solved the leak:

new PublisherAdView(getContext().getApplicationContext())
Daniel Zolnai
  • 16,487
  • 7
  • 59
  • 71