IAd and AdMob are highly memory dependent

I just finished coding my new game for the iOS platform and now I decided it was time to integrate the iAd / AdMob banners at the bottom of the screen. I completed the implementation and the iAd shows up and if it fails then it is replaced with an AdMob banner. This is great, however I checked the app's memory consumption and before the iAd / AdMob integration my app was running using about 19MB of memory - with the iAd / AdMob integration it was running using over 50MB of memory. I have two questions about this: should they be as heavy on memory as this, or am I doing something wrong? Second, it seems like these banner views are never freed from memory. I tried setting adBannerView = nil and then [adBannerView removeFromSuperview], but still nothing happens and the memory is not decreasing at all. FYI - my game is ARC enabled.

Any help on this would be greatly appreciated! Thank.


source to share

1 answer

The memory growth you are seeing is a result of WebKits' contribution to the heap. This sad behavior was the subject of great outrage. You will find this behavior when you try to load banners using your own web views. There have also been similar discussions on SO like this and this one where developers have been locked out in a useless war to try and reduce the memory impact of web loading.

I personally have not used iAds yet, but I am very familiar with the Google Ad integration in iOS and we saw a significant increase in memory after implementation.


That being said, you should consider watching the debug memory gauge, simulate the memory warning, and then your usage should drop. In most of the scenarios I have encountered, WebKit has done a decent job of clearing the in-memory cache.

However, if these memory warnings are not being handled, then you should definitely look for a bug report.



All Articles