I just started using AdMob
but I noticed that, after running it for about an hour, it's accumulated 50MB! Yikes. I thought about releasing it but I can't since I am using ARC
. Any ideas? I'm using the getting started code provided by google:
GADBannerView *bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
CGRect newFrame = CGRectMake(self.scroller.frame.origin.x,self.scroller.frame.origin.y + 70,self.scroller.frame.size.width,self.scroller.frame.size.height);
[self.scroller setFrame:newFrame];
bannerView_.adUnitID = @"XXXXX";
bannerView_.rootViewController = self;
[bannerView_ setFrame:CGRectMake(0,
20,
bannerView_.bounds.size.width,
bannerView_.bounds.size.height)];
[self.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
I had the same problem.
When receiving a new ad, you must remove the previous ad from the parent view.
Otherwise, they are superimposed on each other and consumes memory.
So, after receiving more than 15 advertisements, the percentage of allocated memory remained constant.
Hoping that this will help you.
- ( void )displayBanner:( UIView * )banner
{
UIView * oldBanner = [ _bannerView viewWithTag:999 ];
if( oldBanner )
{
[ oldBanner removeFromSuperview ];
oldBanner = nil;
}
banner.tag = 999;
[ _bannerView addSubview:banner ];
}
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