iPhone 操作系统支持的最大堆大小和堆栈大小是多少?

发布于 2024-09-06 21:54:41 字数 74 浏览 10 评论 0原文

谁能告诉我 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一指流沙 2024-09-13 21:54:41

您可能得到的任何数字都可能

  1. 会发生变化(即使它们现在是正确的,但在某些时候它们很可能是错误的),而且
  2. 毫无用处。

具体来说,您正在对这两个数字做什么?跟踪您分配了多少内存?当你用完时你会做什么?当发生这种情况时,iOS 会向您发送一条消息,告诉您释放一些内存;你会采取什么不同的做法?

不要担心对自己施加限制。尽可能高效。

应用程序很快就会“内存不足”...

那么您的内存就没有效率。使用 Instruments 的 ObjectAlloc 和 Leaks 工具分析您的应用程序,并找出效率低下的地方。一旦修复它们,您的应用程序将不再经常出现内存不足的情况。

您还应该阅读内存管理编程指南,如果你还没有。您可能只是没有发布需要发布的内容。如果是这种情况,您将使用 Leaks 仪器看到大量泄漏。

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.

执笏见 2024-09-13 21:54:41

如果您有无限(非尾)递归,您将被放入带有大约 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文