I frequently run low on disk space on my laptop. When I'm down to my last gig or so on my 256MB SSD (as reported by iStat Menu), I'll get various warnings from the OS and apps saying that I'm running out of space.

I can empty my trash, which buys me a little more time, but eventually I will run out of space and won't have any more to empty in my trash.

The weird thing I have discovered is that if I reboot my mac, I get another 8-10 gigs of storage back for free. After a reboot just now, iStat is now reporting 10.83GB free, and the Finder confirms it (reporting 10.96).

What I don't understand is where this storage is coming from.

At first I thought it might be related to Spotlight indices, since I've often noticed that spotlight has to re-index after a reboot. However, after spotlight appears to finish indexing (as reported in the spotlight menu), the available disk space is still over 10 gigs. So it's likely not spotlight.

The amount of space I get back is suspiciously close to the amount of RAM I have in my machine (8 gigs). Could it be related to virtual memory?

My assumption is that somehow it's related to temporary cache files, but I don't know which or why, or how to clear those caches without a reboot.

So my question is: Why do I get back 8 to 10 gigs of storage space after a reboot when my hard drive runs low on space?

2 Answers 2


When the OS is low on memory it creates a file called a swap file, aka virtual memory on your hard drive, and in OS X this starts at some amount (I think 64 MB) then double as needed. So if you have 8 GB of RAM, you could end up with an 8 GB swap file. This is then deleted when you reboot.

You can read about it on http://en.wikipedia.org/wiki/Paging

Where the files are located and how to disable it: http://osxdaily.com/2010/10/08/mac-virtual-memory-swap/

  • OSX creates these files as memory is used not when the OS is low on memory - also the swap file size is not related to the memory in the machine - sleepimage is the size of the memory
    – mmmmmm
    Commented Apr 23, 2013 at 8:00
  • @Mark, and the right answer to the OP is ?
    – Ruskes
    Commented Apr 23, 2013 at 9:12
  • Doesn't the OS need to allocate the swap right away after boot? What would explain the gradual disappearance of my storage over time?
    – emmby
    Commented Apr 23, 2013 at 10:04
  • Please elaborate on the gradual disappearance ! After reboot system is still loading your applications and gradually increasing the swap file as needed.
    – Ruskes
    Commented Apr 23, 2013 at 22:50

As @pg-robban suggested, the most likely cause of this is that the system's swap space is growing until it fills the HD. To check whether this is really what's going on, run the Activity Monitor utility, select the "System Memory" tab at the bottom of its window, and check the "Swap used" statistic; if it grows as you use the computer, that's what's eating the HD space.

If that is the problem, the next step is to figure out what's eating all of the space. In Activity Monitor, switch the pop-up menu near the top of the window to "All Processes" and sort the process list by the "Real Memory" column. Unfortunately, this number doesn't include swap usage, but it's still a pretty good guide to which programs are using the most memory (the "Virtual Memory" column is not particularly useful, since it includes some categories of "memory" that don't take up any actual space, either in RAM or on HD).

It's likely that some program is leaking memory, i.e. using more and more as it runs. It may be that you can quit that particular program and reopen it and get its memory usage to go back down. Depending on what program it is, you it might be possible to figure out why it's leaking memory and fix it (unless the program is just plain buggy/badly designed).

Note that quitting & reopening the program won't recover the HD space (at least immediately). OS X is fairly lazy about releasing swap space when it's no longer needed. But if you make a habit of quitting & reopening the program frequently so its memory usage never gets too big, the OS shouldn't have to allocate the swap space in the first place.

BTW, you can get slightly more info about the system's swap file with the command sysctl vm.swapusage. For example, my Mac currently has 1GB of HD space allocated to swap, but it only using 470MB of it:

$ sysctl vm.swapusage
vm.swapusage: total = 1024.00M  used = 470.80M  free = 553.20M  (encrypted)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .