Memory management in OS X is done primarily by the operating system's virtual memory system; however, there are a few approaches you can take to force the system to clear some aspects of its memory structure and free it up either for troubleshooting purposes or to perhaps help performance.
Part of the, where recently used program information is stored so the system can more swiftly launch the program if needed. If you open the Activity Monitor utility in OS X and view the System Memory section, you will see this cache represented by a blue "inactive" wedge of the memory-use chart. Usually this is the same as free memory for the system to use and should be dynamically cleared as RAM demands increase, but sometimes this process may not occur or you might wish to troubleshoot a system with a minimal cache so applications launch essentially from scratch.
Since the OS manages memory, there is no way to simply turn this feature off; however, you can force the system to clear this cache by using a program to maximize the memory usage and demand as much physical RAM as possible from the system. While the resulting increase in free memory from doing this is temporary, it will for a while force the system to clear the cache and relinquish as much free RAM as possible.
To aid in doing this, several developers have created third-party utilities that perform this procedure, but with recent versions of OS X, Apple has included a command line tool that will also do it (you may need to install Apple's XCode developer tools to get this command). By opening the Terminal and the command "purge" you will instruct the system to clear the cache in its memory system and convert much of the inactive memory to fully free memory.
Unfortunately this command may not work properly if you have installed the latest OS X 10.8.1 update, and when run, you might see an error similar to the following:
[ERROR] <CPPathUtils.c:526> The device-file for this operating system, 'osx-12.1.0.xml', was not found. An attempt to revert to a previous revision of the OS device-file: 'osx-12.0.0.xml' has been made. Please file a Radar report with Apple, on the 'CoreProfile' component, version 'X'.
This error simply indicates a bug where Apple has not included or has not properly linked to a required file for handling debugging and development features for the OS X memory, drivers, filesystem, and network, among other services. Since this file is required for proper use of the purge command in OS X, it will give this error and not execute.
Unfortunately this error will likely have to be handled by Apple, and should be fixed in a future update. Until then, if you need to purge your system's memory cache then you can do so using third-party tools, many of which can be found by searching for "free memory" in the Mac App Store.