广告与广告AdMob 占用大量内存 [英] iAd & AdMob Heavy on Memory

查看:32
本文介绍了广告与广告AdMob 占用大量内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了针对 iOS 平台的新游戏的编码,现在我决定是时候在屏幕底部集成 iAd/AdMob 横幅了.我已经完成了实施,并且 iAd 出现了,如果它失败了,那么它将被 AdMob 横幅所取代.这很棒,但是我检查了应用程序的内存消耗,在 iAd/AdMob 集成之前,我的应用程序使用大约 19MB 的内存运行 - 使用 iAd/AdMob 集成时,它使用超过 50MB 的内存运行.我对此有两个问题 - 他们应该像这样记忆如此重还是我做错了什么?其次,这些横幅视图似乎永远不会从内存中释放出来.我尝试设置 adBannerView = nil 后跟 [adBannerView removeFromSuperview] 但仍然没有任何反应,内存也没有减少.仅供参考 - 我的游戏启用了 ARC.

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. I have completed the implementation and an iAd is showing up and if it fails then it is replaced by an AdMob banner. 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. 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. F.Y.I - my game is ARC enabled.

对于此事的任何帮助将不胜感激!谢谢.

Any help on this matter would be greatly appreciated! Thanks.

推荐答案

您观察到的内存增长是 WebKit 对堆的贡献的结果.这种不幸的行为引起了很多愤怒.如果您尝试使用自己的 Web 视图加载横幅,您会发现类似的行为.关于 SO 也有类似的讨论,例如 this one这个 开发人员陷入了一场徒劳的战争,试图减少网页加载对内存的影响.

The memory growth you are observing is a result of WebKits contribution to the heap. 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. 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.

我个人还没有使用过 iAd,但我对 iOS 上的 Google Ad 集成非常熟悉,我们看到实施后内存显着增加.

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.

话虽如此,您应该考虑观察调试内存量表,模拟内存警告,然后您的使用量应该会下降.在我遇到的大多数情况下,WebKit 在删除其内存缓存方面做得不错.

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.

但是,如果未处理这些内存警告,您绝对应该寻求提交错误报告.

However, If these memory warnings are not handled you should definitely seek to file a bug report.

这篇关于广告与广告AdMob 占用大量内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆