Tuesday, June 13, 2006

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...

7 comments:

Nigel Kersten said...

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

Thinking about a darwinport of it?

leeg said...

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

Nigel Kersten said...

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...

leeg said...

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?

Nigel Kersten said...

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.

Anonymous said...

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

Cheers
-plum

Anonymous said...

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