Brad DeMoss wrote:
I have an 80 GB MacBook Air that is constantly filling up with swap files. I recently had to restart the machine to free up 32 GB of space.
Are you actually seeing 32 GB of hard drive space used by swap files on the drive -- or just going by the "VM size" displayed in Activity Monitor? If the latter, don't worry about it. On my iMac with a total of 169 GB of its HD used, my "VM size" is a whopping 120 GB. Yet /private/var/vm contains only one swap file (swapfile0), using a mere 64 MB (binary base, reported as 67.1 MB in Snow Leopard's decimal based system) of HD space.
"VM size" isn't what you might think it is: it measures the total of how much memory address space is allocated to each process, not the total of how much real or virtual memory each is actually using. The OS creates swap files as needed to handle the necessary VM swaps, & swaps chunks (called pages) of any existing one with real memory without creating a new VM swapfile when it can. (It always creates at least one.) But it only creates new swap files when it must swap out more than it can from the existing ones. So from my swapfile size, I know that since startup the OS has never had to page out more than 64 MB at a time. If it did, it would create swapfile1, which probably would be 64 MB too: although I can't remember the details, the OS is programmed to create new swap files in some sequence like 64 MB, 64 MB, 128 MB, 256 MB, etc. -- whatever the VM designers decided would be the best compromise between efficiency & disk space use.
It is true that the swap files remain & continue to take up HD space until a restart, but they are relatively tiny, at least unless you are using apps that actually require massive amounts of paging to occur.