开发者

iPhone: leaks from other Apps taking up RAM?

I'm reading some people stating that if another (3rd party) app on someone's iPhone has been leaking memory, that this may reduce the (mystery) amount of RAM your app would otherwise have available.

This confuses me -- does not al开发者_开发问答l app memory get released when the app is closed by the user? And only one app is open at a time on iPhone?


Normally, any memory that your application allocates will be freed when it exits. However, many of Apple's applications continue running after they're "closed", so memory leaks in Mail, for instance, can affect available memory.

In addition, there are apps out there that claim to free up allocated memory. They really don't do anything other than force some dirty pages out of the buffer cache, but they appear to do something, so people believe they must be doing something useful.


On a jailbroken phone - yes, third party apps can be running at the same time as yours. Running out of memory is common with people who like to have many apps running at once hence the need for task managers, killing tasks etc.

On an unhacked phone - no. Yours is the only non-apple app that is running, no others can run at the same time.

So what can you do? All you can do is try to use the minimum memory possible which you're probably already doing. Realistically you can only test with a factory, unhacked phone, unless you are going to spend hours trying to please everyone. If you think you are maybe using too much you could identify the larger allocations using the instruments tools ("Run with performance tool >" from within Xcode) and then post that chunk of code here to get ideas of how to reduce it.


You should run Instruments and then add the instrument "Memory Monitor" to see the memory use of all of the other processes on your phone. (Add with Window -> Library , then drag the Memory Monitor instrument to the instrument panel.

What I'm still trying to determine is why is iOS releasing memory from MY app, and not all of the other memory pig apps that are not currently running.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜