简体   繁体   English

iAd和AdMob占用大量内存

[英]iAd & AdMob Heavy on Memory

I've just completed coding my new game for the iOS platform and now I decided that it is time to integrate iAd/AdMob banners at the bottom of the screen. 我刚刚完成了针对iOS平台的新游戏的编码,现在我决定是时候在屏幕底部集成iAd / AdMob标语了。 I have completed the implementation and an iAd is showing up and if it fails then it is replaced by an AdMob banner. 我已经完成了实施,并且iAd正在显示,如果失败,则将其替换为AdMob标语。 This is great, however I checked over the memory consumption of the app and prior to iAd/AdMob integration, my app was running using around 19MB of memory - with the the iAd/AdMob integration, it is running using over 50MB of memory. 很棒,但是我检查了该应用程序的内存消耗,并且在集成iAd / AdMob之前,我的应用程序运行时使用了大约19MB的内存-通过iAd / AdMob集成,该应用程序运行时使用了超过50MB的内存。 I have two questions regarding this - are they supposed to be so memory-heavy like this or am I doing something wrong? 关于此,我有两个问题-是应该这样占用大量内存,还是我做错了什么? Secondly, it seems as if these banner views are never getting released from memory. 其次,似乎这些横幅视图从未从内存中释放出来。 I have tried setting adBannerView = nil followed by [adBannerView removeFromSuperview] but still nothing happens and the memory does not lessen at all. 我尝试设置adBannerView = nil,然后再设置[adBannerView removeFromSuperview],但仍然没有任何反应,并且内存丝毫没有减少。 FYI - my game is ARC enabled. 仅供参考-我的游戏启用了ARC。

Any help on this matter would be greatly appreciated! 在这个问题上的任何帮助将不胜感激! Thanks. 谢谢。

The memory growth you are observing is a result of WebKits contribution to the heap. 您正在观察的内存增长是WebKits对堆的贡献的结果。 This unfortunate behavior has been the subject of a lot of outrage. 这种不幸的行为引起了很多人的愤慨。 You will find similar behavior if you try and load the banners using your own web views. 如果尝试使用自己的Web视图加载横幅,则会发现类似的行为。 There has also been similar discussions on SO like this one , and this one where developers have been locked in a futile war to attempt to reduce the memory impact of web loading. 同时也出现了对SO像类似的讨论这一个 ,而这一次 ,开发人员已被锁定在一个徒劳的战争,以试图减少网络负载的内存的影响。

I personally haven't used iAds yet but I am very familiar with Google Ad integration on iOS and we saw significant memory increases post-implementation. 我个人还没有使用过iAd,但是我对iOS上的Google Ad集成非常熟悉,我们发现实施后内存会大大增加。

TL;DR TL; DR

That being said you should consider observing the debug memory gauge, simulate a memory warning, and then your usage should drop. 话虽这么说,您应该考虑观察调试内存条,模拟内存警告,然后使用率会下降。 In most scenarios I have encountered WebKit has done a decent job of removing its In-Memory cache. 在大多数情况下,我都遇到了WebKit在删除其内存中缓存方面做得不错的工作。

However, If these memory warnings are not handled you should definitely seek to file a bug report. 但是,如果未处理这些内存警告,则绝对应寻求提交错误报告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM