问题描述
我正在开发一款至少以3g为目标的ios游戏。我们正在使用高清资产用于视网膜显示设备(iphone 4,ipod touch 4th gen)。
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(256与Iphone 4的512相比),但我们正在使用HD资产。该应用程序曾经在尝试加载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 app最大内存预算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!