OS X memory clean up w/o reboot

March 3, 2011 at 2:49 pm

| Gabriel |

Windows XP had a notorious bug (which I think has been fixed in Vista/7) that it didn’t allocate memory very well and you had to restart every once in awhile. Turns out OS X has a comparable problem. Via the Atlantic I see a trick for releasing the memory.

Basically, you do a “du” query and this tricks the computer into tidying things up. This takes about fifteen minutes and implies a noticeable performance hit but after that it works much better. Ideally, you run it as root and the Atlantic suggests a one-liner that uses sudo, but keeping your root password in plain text strikes me as a really bad idea. Rather I see three ways to do it.

  1. Run it as a regular user and accept that it won’t work as well. The command is just
    du -sx /

    and you can enter it from the Terminal, cron it, or save it as an Automator service.

  2. Do it interactively as root, which requires this code (enter your password when prompted).
    sudo du -sx /
  3. Cron it as root. Here’s how to get to root’s cron table
    sudo -i
    crontab -e

    Once in the cron table just add the same

    du -sx /

    command as before, preferably scheduled for a time when your computer is likely to be turned on but not doing anything intensive (maybe lunch time).

Entry filed under: Uncategorized. Tags: .

Fashion is danger Misc Links

The Culture Geeks

%d bloggers like this: