Admob Application Memory Leak

83 views
Skip to first unread message

Kenneth Liang

unread,
Oct 25, 2014, 3:10:37 PM10/25/14
to google-adm...@googlegroups.com

Hey everyone. I've implemented an ad banner in onCreate() as follows:
        adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                .build();
        adView = new AdView(this);
        adView.setAdSize(AdSize.SMART_BANNER);
        adView.setAdUnitId(getResources().getString(R.string.bottom_banner));
        adView.loadAd(adRequest);
and in onDestroy():
        adView.destroy();

Everything works. The problem is when I close the app and reopen it. The activity instance from before remains and a second activity is created, thus causing a memory leak. Looking at the hprof dump file, it looks like L10nUtils and WebView are keeping references of the activity. I believe that some component callbacks need to be unregistered in admob as the majority of the references are located there. Are there any solutions out there for this? Below is an image of the dump after closing and opening the app about 12 times.


Eric Leichtenschlag

unread,
Oct 28, 2014, 10:20:37 AM10/28/14
to google-adm...@googlegroups.com
Hello,

What SDK version are you using?

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages