iphone 3gs 内存警告 通话查询

发布于 2024-10-19 15:05:41 字数 106 浏览 2 评论 0原文

嗨,我只是想知道这一点:iphone 3gs 和 iphone 4 何时会发出内存警告,

我的意思是,在我们的应用程序使用了多少内存后,这两个设备都会发出警告?

谢谢

hi i just want to know this: When will iphone 3gs and iphone 4 send out memory warnings

i mean after how much memory our app uses does the both devices send warnings?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

孤寂小茶 2024-10-26 15:05:41

你不知道它什么时候会火。您不知道后台运行的其他应用程序、保存网页的 Safari 等使用了多少内存。Pandora 可能在后台进行流式传输,并且可能使用大量内存。不要指望任何单一的内存量。延迟加载,并在 didRecieveMemoryWarning 中释放不需要的分配。
如果您的应用程序需要大量内存,一些游戏开发人员会告诉用户在玩游戏之前重新启动设备,以确保应用程序获得最大内存和最佳性能。

You don't know when it will fire. You don't know how much memory is being used by other apps running in the background, Safari keeping webpages, etc. Pandora might be streaming in the background and it might be using a significant amount of memory. Don't count on any single amount of memory. Load lazily, and release uneeded allocations in didRecieveMemoryWarning.
If your app requires a lot of memory, some game developers tell their users to restart the device before playing to ensure the most memory for the app, and best performance.

菩提树下叶撕阳。 2024-10-26 15:05:41

它没有严格定义,但 Apple 建议您不要使用超过 24MB 的图形内存,因为图形内存的过度使用通常是应用程序收到内存不足警告的原因。
管理 iPhone 上的严重内存不足情况的唯一好方法是实现 didReceiveLowMemoryWarning 委托方法并在此时释放尽可能多的内存。例如,这意味着:

  1. 当前加载到内存中的所有不可见图像
  2. 所有视图控制器及其子视图(如果未使用)

如果您的应用程序能够在稍后阶段重新加载该信息,这当然可以安全地完成。然而,didReceiveLowMemoryWarning 是应用程序的最后手段。

为了避免达到这一点,建议仅在需要时延迟加载资源,并在不再需要时释放它们(例如在所有控制器上实现 viewDidUnload)。

It is not strictly defined but Apple suggests you don't use more than 24MB of graphical memory as overuse of graphical memory is typically why an application receives a low memory warning.
The only good way to manage critical low memory situations on the iPhone is to implement the didReceiveLowMemoryWarning delegate methods and release as much memory as possible at that point. This means for instance:

  1. All non-visible images currently loaded in memory
  2. All view controllers and their subviews if not in use

This can of course be done safely provided your application is able to reload that information at a later stage. didReceiveLowMemoryWarning is however a last resort situation for your application.

To avoid getting to that point it is recommended to only load resources lazily i.e. when and only when you need them, and release them when they are no longer needed (for instance implementing viewDidUnload on all your controllers).

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