iPhone 操作系统支持的最大堆大小和堆栈大小是多少?
谁能告诉我 iPhone 支持的最大应用程序大小是多少?另外支持的最大堆大小和堆栈大小是多少?应用程序很快就会“内存不足”......
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能得到的任何数字都可能
具体来说,您正在对这两个数字做什么?跟踪您分配了多少内存?当你用完时你会做什么?当发生这种情况时,iOS 会向您发送一条消息,告诉您释放一些内存;你会采取什么不同的做法?
不要担心对自己施加限制。尽可能高效。
那么您的内存就没有效率。使用 Instruments 的 ObjectAlloc 和 Leaks 工具分析您的应用程序,并找出效率低下的地方。一旦修复它们,您的应用程序将不再经常出现内存不足的情况。
您还应该阅读内存管理编程指南,如果你还没有。您可能只是没有发布需要发布的内容。如果是这种情况,您将使用 Leaks 仪器看到大量泄漏。
Any numbers you may get are
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.
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.
如果您有无限(非尾)递归,您将被放入带有大约 20k 堆栈帧的调试器中。我不确定这对应于多少字节,但对于任何有意义的事情来说已经足够了。
除了通常的地址空间限制(可能在 3GB 左右)之外,没有设置最大值;您的应用程序正在被杀死,因为设备的物理 RAM 已耗尽,并且没有更多的后台应用程序可以杀死。
如果你因为内存不足而被杀死,那么你要么做了一些非常愚蠢的事情,要么存在内存泄漏。
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.