开发者

what is the maximum heap size and stack size supported by iphone os?

开发者_运维技巧

Could anyone tell me what is the maximum application size supported by iphone? Also what is the maximum heap size and stack size supported? Application goes 'out of memory' very soon...


Any numbers you may get are

  1. Subject to change (even if they're correct now, they may very well be wrong at some point), and
  2. Useless.

What, specifically, are you doing to do with either of these numbers? Track how much memory you allocate? And what will you do when you run out? iOS sends you a message telling you to free up some memory when that happens; what will you do differently?

Don't worry about enforcing limits on yourself. Just be as efficient as you can be.

Application goes 'out of memory' very soon...

Then you are not being efficient with your memory. Profile your app using Instruments's ObjectAlloc and Leaks instruments, and find out where your inefficiencies lie. Once you fix them, your app will not be constantly running out of memory anymore.

You should also read the Memory Management Programming Guide, if you haven't already. It's possible that you're simply not releasing things that you need to release. If that's the case, you'll see a lot of leaks with the Leaks instrument.


If you have infinite (non-tail-)recursion, you get dropped into the debugger with around 20k stack frames. I'm not sure how many bytes this corresponds to, but it's enough for anything sensible.

There's no set maximum apart from the usual address space limit (probably around 3GB); your app is getting killed because the device has run out of physical RAM and there are no more background apps to kill.

If you're getting killed do to low memory, you're either doing something very silly or there's a memory leak.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜