.... I've read that if you close an app, it may continue to run that app's processes in the background in case you relauch the app, so that it starts faster, but I haven't seen this in action yet. ...
If you want to see evidence of this, go to Activity Monitor and look for Inactive memory. That's the memory that is held by the OS for apps that you recently shut down. Lion seems to hold onto that memory for a rather long time (maybe that long time is a bug ... I'm not sure), and it can grow to be a fairly large quantity.
If you have a "small" amount of RAM on your system (4GB or less with Lion), that large amount of Inactive memory will slow down the entire system, and it is a major contributor to the battery/fan/temperature issues in Lion that many people have been complaining about here. A large amount of Inactive memory might also contribute to a slow shutdown, although I haven't had time to investigate this possibility.
But where are the processes that are "holding" on to that RAM? I mean, when I exit an app, I'm seeing all the apps' processes closing also.
The processes, themselves, don't hold onto the RAM. The OS holds it in the Inactive memory cache, and somehow the OS remembers the apps that were previously using this memory. If any of those apps restart, their previously held memory is reassigned to them, and they (allegedly) start up faster.
For example, suppose you were running Safari for a while and it was using, say, 250 Mb of RAM. Then, suppose you close Safari. At that point, this 250 Mb will be assigned to Inactive memory and somehow marked as belonging to Safari. Then, the Safari process will disappear.
Later, if you restart Safari, that 250 Mb of RAM will be reassigned to it.
The 250 Mb will eventually be removed from Inactive memory if you don't restart Safari for a while, but it seems like "eventually" is a rather long period of time under Lion.
On my 4 Gb MacBook Pro running Lion, my Inactive memory climbed to more than 1 Gb after maybe 15-30 minutes of use! ... and it remained at that level for at least a couple hours longer. This caused increased swapping of the apps that were in use, and that caused the CPU to run hotter, the fans to run, the battery to drain faster, and the system overall to run noticeably more slowly.
Since it takes time to release that Inactive memory (it's a procedure that's called "purging" in Apple terminology), I imagine that a system that is holding a lot of Inactive memory will take longer to shut down ... since it takes longer to do everything else, as well.
Apple's support web site has this article which explains Inactive memory, among other things: http://support.apple.com/kb/HT1342
So I would take this as a fact.
Furthermore, I have made use of the following hack to periodically "purge" Inactive memory when its usage becomes too high. This has solved my heating/fan/slowness issues under Lion: https://discussions.apple.com/message/15897987#15897987
This also has resulted in faster shutdowns for me.
Other people here have also reported that the "purging" of Inactive memory has helped with slowness and heating problems.
And finally, this message talks about the fact that Apple seems to have recognized that memory issues are a problem in 10.7, and that they are addressing these issues in an upcoming 10.7.2 release: https://discussions.apple.com/message/15920691#15920691
(Look for the comment by "mightymilk" on or near the final page of that message's discussion list).
Well, that article was written in 2010, before OS X Lion, and hence before OS X's Lion's new feature which supposedly sometimes "keeps an application running" even when you quit.
I think what you're talking about may help applications launch more quickly, but it's not the specific new feature in Lion I was talking about.
From the Ars Technica review of OS X Lion:
As if all of this isn't enough, Lion features one final application management twist. When an application is terminated in Lion, all the usual things appear to happen. If the running application indicator is enabled, the small dot will disappear from beneath the application's Dock icon. Assuming it's not a permanent resident, the application icon will disappear from the Dock. The application will no longer appear in the command-tab application switcher, or in Mission Control. You might therefore conclude that this application's process has terminated.
A quick trip to the Activity Monitor application or the "
ps" command-line utility may dissuade you of that notion. Lion reserves the right to keep an application's process around just in case the user decides to relaunch it. Upon relaunch, the application appears to start up instantly—because it was never actually terminated, but was simply removed from all parts of the GUI normally occupied by running applications.
That's right, gentle readers. In Lion, an ostensibly "running" application may have no associated process (because the operating system automatically terminated it in order to reclaim resources) and an application may have a process even when it doesn't appear to be running.
Furthermore, reading your hack mentioned above, you write:
"Using the Activity Monitor, I see that after a short time of running after boot-up, more than 25% of my available memory is sitting in the "Inactive" state. This is memory that is released to the OS after applications run, but which is held for a period of time, or until the applications in question restart. This allows those applications to restart a little more quickly, at the cost of preventing other applications from using that memory while it's being held."
Yet the very article you pointed me to clearly says:
"For example, if you've been using Mail and then quit it, the RAM that Mail was using is marked as Inactive memory. This Inactive memory is available for use by another application, just like Free memory. "
So the logic behind your whole hack is faulty. And you wonder why people in the forum were warning others about copyng and pasting your hack! Because Apple is better equipped to manage memory than you are.
I'm not trying to be argumentative, but it's just very annoying when Mac OS X users are offering facts when they are clearly theories. Something as important as memory management shouldn't generally be overridden by inexperienced users.
Yes, you are right that the Inactive memory is stated as being utilizable by other applications. I had misread that part of the documentation.
Nonetheless, utilizing my hack has pretty much solved the problems I was seeing under Lion concerning slowness, heat, and the fan. In other words, when "purge" is periodically invoked to release Inactive memory, my computer runs faster, cooler, and with hardly any use of the fan. And by "faster", I also include faster shutdowns
Furthermore, I can cause those problems to return simply by disabling my hack. In other words, when I turn off my hack without changing anything else, the heat, fan, and slowness issues return. And by "slowness", I also include slow shutdowns.
And then, when I re-enable my hack, the heat, fan, and slowness issues more or less go away again ... and the computer shuts down noticeably faster again.
I have just finished performing those tests again, and the results continue to confirm what I have just now stated here.
The only thing that my hack affects is the amount of Inactive memory. Therefore, I have empircally demonstrated -- at least on my own computer -- that a large amount of Inactive memory has a negative noticeable effect on speed (including shutdown speed), temperature, and fan use, and that releasing this Inactive memory improves all of these items.
Why don't you just try this, yourself, and see whether you get these same, empirical results?
I found a temporary solution, at least till Apple releases a fix.
I have notice there was a lot of Background activity, I decided to try deactivating Spotlight, preventing it to search on the following locations: Macintosh HD, Windows (BootCAMP drive), basically all drives.
The boot and shut down time are like snow leopard now, a lot faster then b4 even if I leave all applications on and choosing the option to reopen them at login.
Of course now the spotlight search won't work, but it's a good compromise for the time being... I do not use it at all anyway
I hope it helps
I have two iMacs running Lion. My newest is the 27" iMac with the i7, 12GB RAM and it came with Lion factory installed. The other iMac is my 24" 2008 with the 3.06 GHz Intel Core 2 Duo and 4GB of RAM. When I received my new 27" during the install I used the Time Capsule to install all programs and files to my new iMac. The new iMac with the factory installed Lion OSX takes 20-30 seconds of additional time to shut down. My older iMac which I upgraded to Lion take about 5 seconds to shut down as it did with Snow Leopard.
Make sure u update both machines and then please provide a list of applications and background applications u have running (ie: dropbox). It might be related to what's running in the background. I have had a similar issue shutting down when I was doing processor intensive stuff. Even after quiting them I had the issue.
I have this problem too, the only thing I did to speed the shutdown up a bit was to clear safari's cache, it seem to be a workaround, but hopefully the next update will solve it. I had the same problem with SL until the second update came out. And since installing IOS 5 my iPod touch is slower at shutting down too
I have finally resolved the shutdown time on my Macbook Pro. I ended up completely reformatting the harddrive and re-installing Lion and restoring the rest from Time Machine. The system now shuts down in 4-5 seconds and generally is much more stable.
A real pain but the system had become unstable and I just "bit the bullet" and did it. I let the Time Machine run overnight since I have a 750 gb drive that was hal full.