7

In Mac OS X Lion (10.7) Apple introduced a feature called "Automatic Termination" where apps would automatically quit after a while of inactivity.

I personally only ever saw this working with Preview and a few other apps. Neither Apple nor third-party developers seemed to adopt it much. And in recent years, I haven't seen a single app automatically quit, not even Preview.

My question is, what happened to this feature? Does it still exist? Do any developers make use of it? And why did Apple themselves stop using it in their apps?

2 Answers 2

5

Automatic Termination remains part of macOS. When implemented correctly, you should not see it in action.

To discover which applications know about Automatic Termination, issue the following command in Terminal.app:

grep -r NSSupportsAutomaticTermination /Applications

Requires More Code

Supporting Automatic Termination requires additional and, frequently involved, effort from the application developer.

The application needs to deal with an environment where it could be required to quit at (almost) any time; that means being able to save and restore state quickly, with no user interaction, and at (almost) any moment:

Automatic termination is a feature that you must explicitly code for in your app. Declaring support for automatic termination is easy, but apps also need to work with the system to save the current state of their user interface so that it can be restored later as needed. The system can kill the underlying process for an auto-terminable app at any time, so saving this information maintains continuity for the app. Usually, the system kills an app’s underlying process some time after the user has closed all of the app’s windows. However, the system may also kill an app with open windows if the app is not currently on screen, perhaps because the user hid it or switched spaces.

Ask Apple

Why Apple appears to have removed support from some of their applications in OS X 10.11 is a question best directed to Apple.

A Matter of Priorities

Anyone who writes Mac applications must judge if this is a feature worth implementing and if that engineering time is better spent elsewhere. This will always be a matter of judgement for the developer, so I suspect your question can never be definitively answered.

Tell Developers

If you have applications you want to support Automatic Termination, tell the application's developers. If enough customers value Automatic Termination, then developers will make the time to implement it.

6

The answer of Graham Miln is very complete, there's just a few notes I'd like to add:

1) An app can support Automatic Termination or Sudden Termination or even both. The difference between these two is: With Automatic Termination the system can quit the app "at will" but it will quit it "normally" (just as if you choose Quit <AppName> from the <AppName> menu), allowing the app to perform some work on quit, so it can be restored back into that state when being reopened. With Sudden Termination, the system can "kill" the app "at will" without any chance for the app to perform any actions prior to dying as it will die instantly, which is much faster.

2) Apps can support either form of termination without declaring it in their Info.plist file, so the grep not listing an app doesn't mean the app won't support either feature. Actually the Info.plist entry only changes the default behavior of an app. The default behavior is to support neither one, unless the code enables either one explicitly. When declared in their Info.plist file, the behavior is the other way round: The declared feature is enabled by default, unless the code disables it explicitly.

3) The reason for controlling these features in code is that only the app itself can know if is currently really idle or actually waiting for some event to take place and thus must not die at the moment. So an app can temporary switch both off while waiting for something to happen or processing some data internally and then switch them back on once done.

4) In both cases, the system decides when to terminate an app and when not ("at will") and in many cases the system just doesn't want to as it has no reason to do so. E.g. if the system runs out of memory, it will aggressively look for apps it can terminate to quickly free up memory for those that shall continue to run but as long as there is no shortage, what advantage would it have for the system to kill these apps? Next time you use them they only need to be restarted which is a waste of processing time when there was no reason to quit them in the first place. And memory shortage is not defined by the amount of free memory you have (you have no shortage just because all memory seems in use) but by the so called "memory pressure". Activity Monitor can show you the memory pressure of your system. So just because an app supports either form of termination, it's not said that the system will actually make use of that feature.

5) With the introduction of XPC services in 10.8, some apps started to use these little helpers for performing their processing tasks. XPC Services implicitly support Sudden Termination. Despite belonging to an app, XPC Services don't display any UI (and don't show up in Dock), so you won't notice when they are started and when they are terminated. That means instead of having the system terminating the whole app to save resources, resource intense apps can use XPC Services and the system will terminate these XPC services if required which often makes it unnecessary for the app itself to support either form of termination as terminating the app will now hardly save the system a lot of resources if the main resource usage is caused by the XPC Services of that application.

2
  • Is there a source that confirms that "XPC Services implicitly support Sudden Termination"?
    – Kentzo
    Commented Jun 22, 2020 at 12:33
  • 1
    @Kentzo developer.apple.com/library/archive/documentation/MacOSX/… Quote: "Because an XPC service can be terminated suddenly at any time..." But you can prevent that if you disable sudden termination in your code.
    – Mecki
    Commented Jun 22, 2020 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .