free as in, well, free(1)

The linux tool free(1) just reports how much memory is free (and how much is in use).  Simple, really.  There’s no obvious equivalent for Darwin, though.  We’ve got top(1) which is overkill, and vm_stat(1) which is abstract to say the least.  I wrote a variant of free(1) for Darwin a while back, but never reported on the virtual memory (swap) usage.  Now I’ve found out enough about the Mach virtual memory manager to include that, there’s an updated Darwin free available.  Excuse the manpage, I haven’t updated it to track the new version yet.

I also found out enough about the Mach virtual memory manager to realise that there are a few things I want to change about the dynamic pager.  Without a degree in operating systems design, this might take a while…

This entry was posted in whatevs. Bookmark the permalink.

7 Responses to free as in, well, free(1)

  1. Anonymous says:

    nice. I’d noticed your post on darwin-dev about this.

    Thinking about a darwinport of it?

  2. Graham Lee says:

    Nigel: I hadn’t been thinking of such, but now that you mention it…maybe I will :-)

  3. Anonymous says:

    Seeing as you’ve become such a vm expert… :)

    I’d like to see someone do a really authoritative article on how to read vm_stat…

  4. Graham Lee says:

    Give me time….

    BTW, I left a comment on your ‘sleepimage’ post, but I’m not sure that it actually stuck. Is it in some mod queue somewhere, or does your blog software not like Omniweb?

  5. Anonymous says:

    Not sure. it’s not showing up in the mod queue… and I’ve disabled modding comments since I got the SCode plugin working with blojsom.

  6. Anonymous says:

    free main.c
    31 pageSize=4096; -> getpagesize();

    Cheers
    -plum

  7. Anonymous says:

    what’s darwin-dev ? i mean, just email me back with the link, is it macosxforge.org or darwinports.org or something? dacresni@slu.edu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.