The necessity of regular use of the 'purge' command in OS X
If you are regularly running low on memory, the use of memory-cleaning tools may just give you a false sense of relief.
When using your Mac, active programs, documents, and system resources will be loaded into memory (RAM), where they can be accessed quickly to run and perform computations. While active memory contents are maintained in memory, the system also keeps some recently used but inactive processes and data there in order to quickly revive them, if needed.
These memory allotments should be managed dynamically for optimum performance, but some people who regularly run low on RAM may be concerned about this and resort to using "RAM cleaning" programs. One of these is the "purge" Terminal command that is installed along with Apple's Xcode developer tools. If you find yourself regularly using these programs, then you might wonder whether this is necessary -- and even healthy for the system.
MacFixIt reader Paul recently wrote in with such a question:
I have only 4 gigs of stock RAM, and the possibility of upgrade in future. Clearing up my RAM cache in terminal by running "purge" at least once a day is getting frustrating. Is it a must to open up terminal and/or to run a purge? Last time I checked it showed about 800 megabytes of usable RAM. Also, is it safe to use the machine with less than 800 megabytes RAM, without any harm to the computer?
Having a low levels of free RAM will not harm your system at all, and will only reduce its capacity to open more items. However, if you are regularly running low on memory, even though programs like "purge" may show an immediate increase in free RAM, this change is only temporary and will not help the system optimize RAM usage. In fact, it may even show a small hit on performance.
The purge command and other memory cleaning routines simply bypass the system's automatic memory management and clear out unused memory contents manually, sometimes doing so by putting a large, temporary load on the system to stress the RAM usage and squeezing the memory footprint of other programs to be as small as possible.
When you run these utilities, you will see the green "free memory" portion of the memory chart in Activity Monitor get larger, suggesting more RAM is now available. However, while this technically does result in more RAM being designated as "free," it is only a temporary measure since the system and programs will progressively load this data back into RAM again, only now being bottlenecked by the hard drive's slower speed and therefore will run a bit slower than usual during this time.
To give an analogy of this process, consider RAM as the tabletop of a desk on which you work. If the table is empty then there is space for you to put the equipment you need for your job -- pens, papers, books, and other tools analogous to applications you use in a computer. However, if the table is smaller, you cannot put as many items on it, or if you do you will have less overall space on which to work.
This is the same for computers, where if you load many programs, widgets, and system tools, then the space remaining to do work will be more limited, especially if you have only a limited amount of RAM to begin with.
Using memory cleaners is like shoving all of your pens, papers, and books into a tight pile in one corner of the desk, and even putting some into the desk drawers to clear as much of the tabletop as possible.
While doing this technically gives you more room in which to work, to get things done you may need to sift through the pile and spread its contents out again. This is what happens with the computer: after running "purge," when you access various programs they will simply spread out and reclaim the RAM and other memory components that you freed up.
Therefore, if you are constantly running low on memory and are seeing regular slowdowns as a result, then upgrade your RAM (to at least double your current amount, especially if you currently have only 4GB) instead of running memory cleaning routines. Getting more RAM for your system would be like getting a table top extension for your desk, so the computer can "spread out" your work, be more efficient, and run at optimal speeds.