开发者

Memory allocation in iphone application

I'm developing a new application for the iphone.

I want to understand something - does the memory that my application uses shared with other applications?

What if an application causes memory leaks, does it effect the device performances after t开发者_JS百科he user closes the application?

thanks.


At the moment, on iPhone you'll only be sharing memory with a certain few applications - MobilePhone, MobileMail, MobileMessaging, Safari, iPod and a few minor daemons.

If you're the active application and you need more memory than is free, then some of these applications (but not the most critical ones, like MobilePhone) will be terminated in order for you to continue. If you continue to use memory, you'll be terminated before the critical apps.

The amount of memory you can use depends on which device you're on and what else is going on on the device. Common advice is that as long as you stay under 30Mb, you'll be fine.

Once an application is terminated, the fact that it leaked memory (or not) is no longer an issue - the system will clean up and free it's entire address space.

Apps sometimes say that you should reboot your iPhone before running the app, clearing the RAM that critical daemons use for caching or whatever during normal use.

If you ever find yourself doing this, stop. If you ship an app with this requirement, you fail as a programmer and should be banned from programming. Why? Look up the amount of RAM a Playstation 2 has, then look at games like Gran Turismo and Grand Theft Auto.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜