What happens when I've closed all of an application's windows on OSX?

I'm used to Windows, where applications disappear from my task tray, Alt+Tab menu, etc. when I close their last window; so it's a little unexpected to me that an application's icon still sits in my Dock and in my Command+Tab windows.

Does the computer's memory, CPU usage, etc. change between that state and when I fully close (e.g. Command+Q) an application? (I have OS X 10.8 if that matters.)


Solution 1:

There is no consensus on whether the app must quit when you close the last window or if the app continues to run, so the decision is left to each developer to decide on an app by app basis. What is true is that quitting an app does release the resources it took - even if some files and code are still stored in RAM or cache until those stores get flushed or used for caching other apps and files at a later time.

Furthermore, there is no restriction prohibiting bad coding, hogging memory, using CPU when no real tasks should be executing, so that as well varies on a case by case basis.

Both Windows and OS X have very good scheduling smarts, paging systems, thread control, etc... and the CPU are all the same in terms of shutting down cores and lowering/raising the frequency based on load to save power and give a "turbo boost" when only one core is executing a single thread.

OS X is starting to let apps signal that they support sudden termination - so that the OS can handle automatic termination, sudden termination and automatic document saving (plus versions) for an app developer. So even if you have told the OS to run a program it can and will decide to "quit" the process so that it won't consume resources while you are doing other things with the computer.

Lastly, with PowerNap on OS X hardware, the line between alseep and awake begins to blur with the system waking partially to perform periodic network tasks which make OS X a bit different than traditional UNIX and Windows in terms of thinking about apps and resource usage.

More reading:

  • The Core App Design - covers both apps that quit when its window closes and those that do not. Further down, the discussion of termination is fairly readable but also technically detailed
  • Mountain Lion: About Power Nap - HT5394

Solution 2:

The answer already given here is a good answer and very precise, but I just want to break this down into laymen's terms for you.

Some programs terminate when you close all their window, others do not. Additionally, some programs have an option in settings where you, the user, can decide if you want the program to quit when the last window is closed.

With regards to memory usage, OS X uses memory management is designed to funnel the most amount of memory to the foremost (active) app, while restricting how much memory is being used by apps that are not the active app. As was already mentioned, though, how well this works depends largely on how well each individual program was coded.