The memory in your system, commonly referred to as RAM, is theto store executable code and loaded data. If your system is slowing down then you may be low on RAM. Although you can install more or free some up by quitting some running programs, first it may help to analyze how much RAM your programs actually are using.
If you open up the Activity Monitor utility on your system and go to the Memory section, you can see a pie chart of the system's physical memory usage, where generally the larger the green and blue sections the better.
When most people think of memory, as it is displayed in the Activity Monitor pie chart, they assume it is the physical RAM in the system; however, in fact the memory that is available to programs and system services is called virtual memory, which is a logical combination of both the physical RAM and the available hard-drive storage. Allocating virtual memory to a program allows the system to swap RAM contents to the hard drive and otherwise manage memory in useful ways.
In OS X one aspect of the virtual memory system is the disk cache, which is used to overcome the relatively slow speed of the hard drive by mirroring its filesystem blocks in memory. When a file is first read, its contents are stored in virtual memory and its blocks are copied to the cache, so when the system writes to the file it has the option to do so in the cache rather than waiting for the slower hard drive. At a later point a separate process synchronizes the modified blocks in the cache with their respective ones on disk.
Some operating systems create the disk cache in a separate allocation of system memory, but in OS X the cache is merged with the virtual memory system and is called the Unified Buffer Cache. This merge results in the cache (and therefore the observed virtual memory use) growing as files are accessed, which at times can result in considerable RAM usage.
As with other aspects of virtual memory, the Unified Buffer Cache should be dynamically unloaded as the system's demand for memory increases (in other words, when you open more programs or files), and therefore not require any user input to manage. However, though clearing the disk cache won't improve performance, it will prevent it from being included in memory measurements and therefore help you find out how much RAM your programs and system processes are truly using.
To do this, open up the Terminal, type the command "purge" at the command line, and then press Enter. This command will take a few moments in which it will stress the virtual memory system to unload cached disk blocks and free them up, and in doing so will appear to reduce the overall memory usage of the system. When it's done, the resulting memory usage by the system should better indicate how much memory your applications and system services are actually using, similar to the levels they used when the system was first booted.
Do keep in mind that while this command will appear to free memory, it will not increase system speed or RAM capacity. Rather, as I've mentioned in the past about other, once you clear the disk cache or otherwise stress the virtual memory system to free up physical RAM, it will slowly begin to equalize and will soon return to its prior RAM usage levels. Therefore, instead of using the purge command or other memory management tools to "free RAM," it may be best to reserve these for determining programs' memory footprints and thereby isolating problems such as memory leaks, or determining if programs themselves are to blame for high RAM usage.