iOS 允许应用程序使用多少内存?
我正在制作一个使用大量相当大的图像文件的应用程序。我注意到,当它们全部加载到我的 iPhone 3G(128 mb 内存)上时,它会崩溃,但当我在第三代 iPod(256 mb 内存)上测试时,它不会崩溃。所以我假设每个应用程序都必须有一定的百分比可以使用?我的应用程序有大约 30 张图像,每张图像大小约为 440k,加载后大小为 13.2mb。我认为这不会太多。它们需要很快地换入和换出,因此从内存中释放未使用的图像似乎不是一个好主意...
编辑:
该应用程序根据手机倾斜的方式交换图像。它是来自 3D 场景的 30 个图像,因此当您移动它时,它会改变视角。它需要尽可能平滑。
I am making an app that uses a lot of fairly big image files. I notice it crashes when they all get loaded on my iPhone 3G (128 mb ram), but not when I test it on a 3rd gen iPod (256 mb ram). So I assume there must be some percentage that is allowed for each app to use? My app has about 30 images at about 440k each loaded so 13.2mb. I didn't think that would be too much. They need to be swapped in and out pretty quickly, so releasing the ones not in use from memory doesn't seem like a good idea...
EDIT:
The app swaps images based on the way the phone is being tilted. It's 30 images from a 3D scene, so when you move it, it changes the perspective. It needs to be as smooth as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案是:随心所欲,直到操作系统抱怨为止。
不存在绝对的内存限制,因为它完全取决于手机的内存、操作系统及其相关服务占用的数量以及每月的时间(开玩笑,但您明白了)。
您应该缩小这些大图像文件以适应内存,或者更重要的是,考虑到屏幕太小并且在任何特定时间只能查看这么多图像,而不是一次加载它们。
The answer is: as much as you want, until the OS complains.
There is no such thing as an absolute memory limit, since it wholly depends on the phone's memory, how much the OS and its related services are taking up, and the time of the month (just kidding, but you get the idea).
You should be scaling down these large image files to fit into memory, or even more so, not loading them all at once considering the screen is so small and only so much can be viewed at any one particular time.