What causes the temporary loss of around 20GB of hard drive space while using XCode?

I've got a hard disk of 120GB (20GB free space). I'm a developer in XCode and sometimes I get the "low disk space error"-message that I can't even save my coded files before cleaning some of the space.
I don't know why this happens because without performing anything I'm losing about 19GB of space. This lost space regains if I restart the mac. I asked around with my friends, and they don't get this kind of behavior, so it seems I'm the only one.

I've tried MACKeeper Utility to clear unused things but it's only a temporary solution!
Does any of you have an idea what to do?


Solution 1:

The issue is probably that the space is being taken up by swap files and possibly a hibernate sleep image. To see this do an ls -l /var/vm These files are deleted on a reboot and start increasing as you use more memory and Xcode takes a lot of memory.

You need to reduce the space used by the rest of the system. apps and data. Basically 120GB is too small unless you only use it for development and not any music or other media files. You can save a bit of disc space by removing unused applications and clearing out other languages (see other questions here) but getting a bigger or external hard disk is probably a better use of your time.

To see where the space goes see the applications in this question or from the command line du.