iPhone OS Memory Warnings. What Do The Different Levels Mean?
Regarding the black art of managing memory on iPhone OS devices: what do the different levels of memory warning mean. Level 1? Level 2? Does the dial go to 11?
Context: After an extensive memory stress testing period - including running my iPad app with the iPod music player app playing, I am inclined to ignore the random yet infrequent memory warnings I am receiving. My app never crashes. Ever. My app is leak free. And, well, the mems warnings just don't seem to matter.
Thanks,
Doug
Basically the warnings mean that the device is running low on memory, and that, "If you could please free some memory you aren't actively using that'd be swell!". If your memory management is tight, and you have no objects that could practically be discarded, just pass the message along and ignore it.
Memory level warnings are logged by SpringBoard. As an app developer you don't need to care about it. Just responding to
-{application}didReceiveMemoryWarningis enough.
There are 4 levels of warnings (0 to 3). These are set from the kernel memory watcher, and can be obtained by the not-so-public function OSMemoryNotificationCurrentLevel()
.
typedef enum { OSMemoryNotificationLevelAny = -1, OSMemoryNotificationLevelNormal = 0, OSMemoryNotificationLevelWarning = 1, OSMemoryNotificationLevelUrgent = 2, OSMemoryNotificationLevelCritical = 3 } OSMemoryNotificationLevel;[/code]
How the levels are triggered is not documented. SpringBoard is configured to do the following in each memory level:
- Warning (not-normal) — Relaunch, or delay auto relaunch of nonessential background apps e.g. Mail.
- Urgent — Quit all background apps, e.g. Safari and iPod.
- Critical and beyond — The kernel will take over, probably killing SpringBoard or even reboot.
Killing the active app (jetsam) is not handled by SpringBoard, but
launchd.
转载于:https://www.cnblogs.com/StarMud/articles/2536034.html
a2614555 原创文章 0获赞 0访问量 222 关注 私信- What do the proximity and orientation sensors in the iPhone do?
- HttpWebRequest's Timeout and ReadWriteTimeout — What do these mean for the underlying TCP connection?
- APC Silcon 60kv - What do all the abbreviations mean
- What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memor
- What do `?i` and `?-i` in regex mean?
- What do Java objects look like in memory during run-time?(未看)
- 《公正:该如何做是好?》(Justice: What's the Right Thing to Do? )【youtube上最受欢迎讲座】【哈佛大学最受新生喜爱公共课】【更新BBC里斯讲座】
- What is the different between Ravencoin and Energo Community
- What do you mean by…?用法
- CBO学习----01--What do You Mean by Cost?
- How do linux kernel know the memory configuration
- ccah-500 第35题 What do you have to do on the cluster to allow the worker node to join
- What does the [Flags] Enum Attribute mean in C#?
- iphone JB开发小记(五)theos的makefile
- What does the SQLERRM Function do
- What's the use of do while(0) when we define a macro?
- What are the advantages of different classification algorithms?
- What do Java objects look like in memory during run-time?
- what is the mean of "GPRINT Type" in cacti
- What do you think is the most important skill every programmer should posses?(转)