"Free RAM problems" observation

agusgriego

Partially Insane
I read a lot of posts in this forum that say after a day of use, the free RAM in OS X goes down, and they get a lot of pageouts...
I also noticed these people often have more than 512 MB of RAM.

I can have my computer turned on for 3/5 days, use photoshop, virtual PC, etc. and when I close all the applications still have the free memory as it should. My G4 only has 320 MB of RAM.

Everyone recommends to give OS X as much memory as you can afford.. but, is this a wise advice? Does OS X "choke" on lots of memory?

Just curious..
 
I'm pretty sure OS X kinda takes the ram and puts it in a "waiting" cache or something, so its technically being used, but not on anything yet.
 
(I should just find the last time I posted this and copy and paste...)


The use of a modern virtual memory system makes measurements of "free" ram much more difficult than simple systems like paleo-macos. Many people looking for a single number misunderstand this, and thus have an incorrect idea of what their system is doing.

The primary reason for this is that osx (like all other unices) uses otherwise-free ram as a disk cache, and simply reallocates it to a running process if it needs it. So ram has very little tendency to sit around completely "free", even though it's available for use by applications.

This means that right after you've quit large applications, and thus deallocated their memory, is the _only_ time you should see any significant amount of ram "free", and then only for a brief window.

Additionally, the system will page out objects which have not been accessed in a very long time, even if it's not actually out of ram. Objects that get used at boot but never again will be put out to pasture; so statistics will show that things have been paged out, even if you've never come close to running out of ram. It's slightly more useful (though only slightly) to measure how many times things have been paged back in.

Lastly, because of the way quartz does window compositing, the memory usage of the Windowserver scales linearly with how many total pixels of window you have open. So having an extra couple dozen windows open can alter your memory usage more than having an additional large application running. Similarly, just using a higher resolution can tend to consume more ram. (None of this was the case with previous windowing systems, which essentially only worry about the end product of what's actually on the screen. But quartz attempts to maintain and make use of more information about all objects its depicting.)


So the short and unsatisfying answer is that there's no definitely correct amount of ram even for a given combination of applications, and there's no easy single number to consult to know whether you need more. If you get the impression that you're swapping, put in more. If not, don't worry about it.
 
Back
Top