4 ms·
> You may think that, if an app is resident in memory, you have to somehow remove it to conserve memory. You don't because iOS does it for you. If there are Sus
by masklinn 15y ago
> You may think that, if an app is resident in memory, you have to somehow remove it to conserve memory. You don't because iOS does it for you. If there are Suspended apps lying around and you launch a memory-intensive app such as a big game, iOS will start to purge Suspended apps and move them to the Not Running state. That is, they will be completely removed from memory and will launch afresh the next time you tap their icon.
This, however, is not "impact-less": when running truly memory-intensive games, they will experience performance degradation while the OS performs cleanup and shutdown of the various applications "hibernating". This is sensible on games like Infinity Blade.
iOS also suffers from not allowing the user to make a distinction between "not running or hibernating" (no resource consumption) and "keeps your GPS or data connection active" (very high battery drain), and not providing a way for the user to know which application requested what (in the way the "Notification" settings let you control notifications rights for all applications, or iOS5's new "General > Usage" gives you a size estimate for the system's applications).
I also believe this:
> 5. Five classes of apps - audio, GPS, VOIP, Newsstand and accessory apps - and some built-in apps such as Mail may run indefinitely in the background until they complete their task.
is partially incorrect in following 4.: these applications can all be killed as memory pressure on the system increases, however they have a "higher priority" (and thus will be killed last) compared to suspended applications.
- adamjernst 15y agoTrue. However I should point out that cleanup and shutdown is pretty minimal: it's killed without warning. (I don't know if you even get a signal handler called.) A hibernating app is not allowed to execute any code.
- saurik 15y agoThis only happens when memory has become critical and not enough applications can free memory fast enough; initially, applications get a low-memory warning and they have an opportunity to deallocate things they are not using in the hope that the system will not have to kill processes. This includes things the developer may not even have explicitly coded, such as dumping video surfaces and sqlite caches. I'm willing to believe (as I have never specifically tested this) that suspended third-party from-the-App-Store ("User") applications are immediately killed without this first stage (although then it would seem weird that they participate in the cross-application memory warning system at all), but the default Apple-provided ("System") applications (such as Safari, Mail, etc.) definitely get this opportunity.
- masklinn 15y ago> I'm willing to believe (as I have never specifically tested this) that suspended third-party from-the-App-Store ("User") applications are immediately killed without this first stage (although then it would seem weird that they participate in the cross-application memory warning system at all) According to the iOS Application Programming Guide[0], > Suspended apps are not notified of termination but f your app is currently running in the background state (and not suspended), the system calls the applicationWillTerminate: method of your app delegate. (this is the iOS5 doc, but the iOS 4 version essentially said the same thing) So a suspended app is killed immediately, a running (backgrounded) app gets the standard applicationWillTerminate: message. [0] http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW49 http://developer.apple.com/library/ios/#documentation/iPhone...
- Someone 15y agoI guess the logic behind that decision is that unsuspending an app and allowing it to run arbitrary code while the system is in a low memory condition will take memory. Because of that, the likely effect of informing swapped-out processes that they will be killed is an avalanche of suspend/unsuspend events, resulting in an unresponsive sytem, similar to the effect of VM trashing.
- masklinn 15y ago> I guess the logic behind that decision is that unsuspending an app and allowing it to run arbitrary code while the system is in a low memory condition will take memory. Even more so as a suspended application already got a message indicating that it was suspended, so it already had the opportunity to perform operations it needs to perform (mostly persisting state). > Because of that, the likely effect of informing swapped-out processes iOS does not swap, the VM only ever uses real memory, suspended processes live fully in real memory.
- andrewflnr 15y agoI know the Pandora app will sometimes delete playing history between times when I have it active. I have always assumed this was because of some memory early-warning system.
- phil 15y agoYou don't get a signal handler; there's no opportunity to execute code.
- phil 15y agoThis, however, is not "impact-less": when running truly memory-intensive games, they will experience performance degradation while the OS performs cleanup and shutdown of the various applications "hibernating". I'm not 100% sure, but I think this is mostly due to how memory warnings are staged. I think the sequence is: OS sends a level 1 memory warning to any running applications. Then it starts killing backgrounded apps. If it kills 'em all and memory is still tight, running apps get level 2'ed. Then it starts killing running apps. So a well behaved game that's running close to the capabilities of the device is likely to do a bunch of stuff that will impact its performance when it gets that level 1 warning. It's going to purge caches and otherwise free a bunch of memory, and you'll see stutter. Furthermore if Mail.app and friends are running, they are probably also going to get warned and eat some time cutting memory use. Again, I don't know the exact cost, but I think killing suspended processes is pretty cheap and it is really the memory warnings that cause a stutter.
- masklinn 15y ago> Again, I don't know the exact cost, but I think killing suspended processes is pretty cheap and it is really the memory warnings that cause a stutter. Might be, my point is mostly that iOS's application management is not as painless and transparent as TFA makes it sound, there are (edge) cases where "not managing background tasks" impacts the experience even when all applications are correctly coded and well-behaved.
- guiambros 15y agoExactly. The management of background apps is FAR from being impact-less as the author gives the impression. Try leaving Skype connected and see what it does to your battery (even when you DON'T want to receive skype calls in the background). While he's correct in stating that the multitasking bar does NOT show apps currently running (just the apps that were recently used, regardless of state), he fails to point that deleting the apps there WILL indeed move the apps from Background or Suspended to Not Running, effectively freeing memory and CPU. And this is exactly the intention of those "authoritative sources" that he criticizes. The recommendation to kill background/suspended apps is an effective (and the only official) way to manually solve battery drain or memory on the 5% of cases that iOS can't do by itself.
- MaxGabriel 15y agoWhen your location is being found, e.g. by the TomTom app running in the background, a purple arrow appears on the top of the screen near the battery meter. In my experience, it's pretty obvious what app is using the background GPS.