View Full Version : Swap File filling up all available HD space
Jan 21, 2013, 11:36 AM
I have a retina MBP with 16GB RAM. The majority of my HD is allocated to Boot Camp, so I have only about 6GB free on my OSX partition. (I plan to change this in the near future.)
recently, I have been getting messages that my Startup Disk is almost full. This seems to happen regardless of what I have open, though it's usually standard stuff (Safari, Word, Preview, etc).
When I run GrandPerspective to see what's taking up so much space, it looks like the Swap File. When I restart, the space is freed up again.
is there a known reason for this? user error?
Jan 21, 2013, 11:46 AM
How much space are the swapfiles taking up? In general on my 8 GB iMac the swapfile space is 256 MB. It has grown to 2 GB every so often depending on what I'm doing.
What are you running that is using up RAM? And what size is your OS X partition.
Jan 21, 2013, 12:21 PM
OS X Lion and Mountain Lion throw that error when your boot partition has less than 7 GB+15% total space available (So if you had a 50 GB partition, it would warn you at 7+(.15*50)=14.5 GB free; if you had only a 10 GB partition, it would warn you at 8.5 GB free.) Since you only have 6 GB available, you're over that threshold guaranteed.
Swap files are just a fact of life in UNIX-type systems. They swap inactive items out of memory onto disk, so that more physical memory is available when a new application launches. In general, you want to have as much free space on your boot partition as you have physical RAM. Obviously, you have less. I can't find any references to how much drive space (raw or percent,) OS X will leave free when swapping; but you are likely coming close to that point.
May 17, 2014, 12:16 PM
I've been getting this error as well recently. I investigated thoroughly this afternoon and found a 6GB sleepimage as well as several (~10) 1G swap files taking up space in /private/var/vm. 6GB is right in line with the amount of RAM on the machine.
I deleted the sleepimage and left the swap alone. Then I watched as the remaining ~6GB of free space was consumed by more swap files. Now there are 19 of them nearly all of them 1GB in size and I'm out of memory again.
There's nothing running right now other than the Finder and Terminal (which I run to use the linux command 'du -sh' to find where the space has gone to).
I know a bit about Unix's, but I've no idea why there are so many swap files in there. Now the machine seems locked up (I'm typing this from a different one). The one I'm at now has a 3GB sleepimage (again, in accordance with the RAM on the machine), but only 9 ~1GB swapfiles...
Anything I can do to optimize this to not just take everything?