iPhone应用程序可以使用多少内存? [英] How much memory can an iPhone app use?

查看:152
本文介绍了iPhone应用程序可以使用多少内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以将我链接到一个描述iPhone应用程序的内存分配的页面。

Can anyone link me to a page that describes memory allocations for iPhone apps.

我听说你被限制在一个约20兆的沙箱,电话状态,但我找不到这个来源。

I have heard that you are limited to a sandbox of ~20 megs, depending on the state of the phone, but I can't find the source for this.

推荐答案

这取决于你的设备使用。我发现,使用iPhone 3G,当您的应用程序使用的总内存超过10-14MB,它很容易崩溃。当它达到20MB,它会崩溃肯定。

It depends on the device you're using. I've found that with an iPhone 3G, when the total memory your app is using goes over 10-14MB, it's vulnerable to crashing. When it hits 20MB, it will crash for sure.

据我所知,苹果公司没有给出任何你可以使用的内存的硬数字。它总是改变,所以很难钉住。他们建议您依靠内存警告,并适当回应。

As far as I know, Apple doesn't give any hard figures for the memory that you can use. It's always changing so it's hard to pin down. They recommend that you rely on memory warnings and respond to them appropriately.

iPhone 3GS拥有更多可用于应用程式的内存量(我听说它大约4倍)。虽然iPhone 3GS只有iPhone 3G的双倍内存,但是大量的内存被操作系统占用。没有任何应用程序可以运行。这就是为什么3GS将允许应用程序使用更多的内存。

iPhone 3GS has a much higher amount of memory available to apps (I've heard that it's around 4 times). Although the iPhone 3GS only has double the memory of the iPhone 3G, a lot of that memory is taken up by the OS. There's very little left for apps to run in. That's why the 3GS will allow apps to use so much more memory.

此外,可能有很多内存已经在由操作系统使用。一个例子是safari正在打开很多标签页。这是为什么很多游戏建议您重新启动设备,如果它崩溃了很多。

Also, there can be a lot of memory already in use by the OS. One example is when safari is keeping a lot of tabs open. This is why lots of games recommend that you restart the device if it crashes a lot.

当你编程时,注意增加内存没有正确地释放对象)和峰值内存。这个问题更多是关于真实世界测试(尽可能多的设备)和良好的编程实践。

When you're programming, keep an eye on the increase of memory (due to not properly deallocating objects) and the peak memory. This problem is more about real-world testing (on as many devices as possible) and good programming practices.

这里有一篇文章准备更多关于如何处理内存问题:

Here's an article to ready more about how to deal with memory problems:

http://akosma.com/2009/01/28/10-iphone-memory-management-tips/

这篇关于iPhone应用程序可以使用多少内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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