Flushing the loo, um sorry the OS


Is there a way to flush OSX from unwanted memory allocations and running processes? I am currently running Finder, IE, and the terminal. Using the command "top" in the terminal I can see what OSX is really doing. Here I see that I have 34 processes, only 2 of which are running, the rest are sleeping. Also that I only have 97.1 MB RAM free, out of 576!!!!! On top of that I even have a couple of thousand pageouts (harddisk memory i believe). What on Earth is OSX playing at!!?! No wonder many things are slow. Common sense tells you that when you quit an app it releases it's memory allocations and CPU resources. This doesn't seem to be the case here!

What I need to know is if there is a quick way of flushing this all out when one needs a quick burst of performance? I mean restarting isn't the most exciting activity really.......:p
But I imagine that while you only have 3 apps open right now, you have opened 15 - 20 apps since you last rebooted.

Windows does a similar thing, where it caches (in RAM or page files) the code neccessary to start the app, so the next time you start it, it starts much faster. This is why the first time you launch explorer, it takes longer. Each successive time you launch the app, it doesn't need to load as much information.

That makes sense, but this seems to steal performance from already running applications, thats no good! :)
Rest assured, OS X is not hogging your 500+ megs of memory.

If you look closely at the results from the "top" command, you'll see that some of it is wired, some active, some inactive, and the rest free. Basically, your "free memory" that you were used to in OS 9 is the inactive + free memory in OS X. This is because, like FaRuvius said, that OS X doesn't free up the memory as soon as an app is quitted, keeping the code in memory for the next time you launch it. When inactive portions of the memory are needed for active applications when you launch them, then that inactive memory will be cleared and the new code loaded into memory. So your double-digit free memory just means that that has never been allocated to any application since you've last restarted, but inactive memory has, even though it is avaiable for other applications.

Get it? :D
I know all this but what disturbs me is that OSX is performing badly, and that I have pageouts with 576 mb of RAM!! I guess some apps feel it is better to use HD ram for some reason, or maybe it has to do with OSX memory management, just like Modern Memory Management under OS9 which suggested to have VM on all the time.

But it is very clear that OSX performs worse and worse the longer it has been on. The only way I know to fix this is simply to restart, as I stated earlier...
When the guys from IBM, after Deep Blue beat Kasparov in a chess match, were asked how their computer beat Kasparov, they responded with the slightly disturbing fact that they didn't really know. They taught it some rules on how to win, how to learn, how to move, but they didn't really teach it strategy on Chess. In truth, only Deep Blue knows how it won, and in reality it doesn't know it won, it just did.

OS 9 was from a simpler time, when you couald actually know what your hardware was doing. That time is past. Now what your hardware is doing is almost governed by fuzzy logic, computer emotion, and whatnot. Why did my computer just spin up the HD? Because it felt it needed to. There wes something it wanted to read or write.

Stop thinking about applications as having space in RAM. They have space in memory. Memory is divided between RAM and HD according to a frequency of use algorithm to allow you to feel like you have more RAM than you do, but not pay for all of it.

VM is a fact now. When an app launches, some of the Memory is givin to it in RAM, but other memory is immediately allocated (conceptually) on the HD. How these decisions are made and the hardware that makes them are difficult to understand, and based on math that doesn't immediately make sense. And what used to be simply the System Suitcase and Finder is now 2 or 3 dozen apps running each in their own protected space. It is this weird complexity to what used to be simple which allows strength where there used to be weakness.

In the end though, you'll either have to learn a lot more, or accept the idea that you don't know nearly as much about the current Mac as you did about your last one.
Very interesting post, thanks! As you say I must completely rethink how my OS works. It isn't until I have left OS9 that I realise what an utter sense of security it is to know pretty much what the OS is doing! For all I know OSX is now running all sorts of interesting things I have little or no idea about! But I do want to learn OSX because it is so powerful.

I guess there are two main changes from OS9 for me. A good one and a bad one. Real multitasking wich means I can hold down the mousebutton without guild ;) ! And the new file system and ownership, which play havock with my carefully tuned caos! To be able to work effectively in OSX I have to organize my files!

Anyway, thanks for your interesting thoughts about OSX and OS'es in general. I will end now since we have gone way off topic :)