ADMOB Memory Leaking? ADMOB Memory Leaking? xcode xcode

ADMOB Memory Leaking?


You need to call destroy() to avoid memory leaks on both banner and interstitial ads. Interstitial ads are one-time-use objects, so you would have to destroy them. Banner ads can be reused but once done using them, call destroy().

See this for reference.


I had the same issue, although with GADInterstitial AdMob ads. HUGE CPU churn from the memory leak. The problem is that you have to go to your actual root view controller. I'm in Objective C, but basically, if you're in, say, a UITabBarController view hierarchy, then try this:

banner.rootViewController = (UITabBarController *)self.view.window.rootViewController

That one thing solved all of my issues. Hope it works!


I think you need to release the banner by setting delegate to nil.From AdMob documentation (see https://developers.google.com/mobile-ads-sdk/docs/admob/ios/banner?hl=es):

Note that if you implement your delegate as a distinct object rather than a GADBannerView subclass you should be sure to set the GADBannerView's' delegate property to nil before releasing the view.

- (void)dealloc {     bannerView_.delegate = nil;   // Don't release the bannerView_ if you are using ARC in your project     [bannerView_ release];      [super dealloc];   }

In your case I think you only need to implement the bannerView_.delegate = nil call.

I hope this helps.