ios应用最大内存预算 [英] ios app maximum memory budget

查看:34
本文介绍了ios应用最大内存预算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款至少针对 3gs 的 ios 游戏.我们将高清资产用于视网膜显示设备(iphone 4、ipod touch 第 4 代).

I'm working on an ios game that's targeting as a minimum the 3gs. We are using HD assets for retina display devices (iphone 4, ipod touch 4th gen).

内存方面,Ipod Touch 4th gen 对我们来说似乎是最受限制的设备,因为它具有与 3gs 相同数量的 RAM(与 Iphone 4 的 512 相比为 256),但我们在其上使用了高清资产.该应用程序曾经在尝试加载 100-110MB 内存时崩溃,但现在我们降到 70MB,我们从来没有加载崩溃.

Memory wise, Ipod Touch 4th gen seems to be the most constraint device for us since it has the same amount of RAM (256 compared to Iphone 4's 512) as 3gs but we're using HD assets on it. The app used to crash when trying to load 100-110mb of ram but now that we're down to 70MB, we've never had loading crash.

经过大量搜索,似乎没有官方硬性限制,那么我们应该如何知道使用多少内存预算才能安全?我们希望能够为美工们提供一个他们可以使用的预算,而无需担心每张地图的内存问题.

After lots of searching around, there seems to be no official hard limit so how should we go about knowing what memory budget to use to be safe? We want to be able to give the artists a budget they can use without memory worries for each map.

推荐答案

我想你已经回答了你自己的问题:尽量不要超过 70 Mb 的限制,但这实际上取决于很多事情:你是什么 iOS 版本'重新使用(不是 SDK)、后台运行的应用程序数量、您使用的确切内存等.

I think you've answered your own question: try not to go beyond the 70 Mb limit, however it really depends on many things: what iOS version you're using (not SDK), how many applications running in background, what exact memory you're using etc.

只需避免即时内存飞溅(例如,您使用 40 Mb 的 RAM,然后分配 80 Mb 的内存用于一些短时间计算).在这种情况下,iOS 会立即终止您的应用程序.

Just avoid the instant memory splashes (e.g. you're using 40 Mb of RAM, and then allocating 80 Mb's more for some short computation). In this case iOS would kill your application immediately.

您还应该考虑延迟加载资产(仅在您真正需要时而不是事先加载它们).

You should also consider lazy loading of assets (load them only when you really need and not beforehand).

这篇关于ios应用最大内存预算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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