Subject: Reporting free memory: vmstat output hard to read
To: NetBSD Users <netbsd-users@netbsd.org>
From: B. James Phillippe spamblock <bryan-spamtrap1@darkforest.org>
List: netbsd-users
Date: 04/23/2002 11:12:02
Hello,

I'm still relatively new to NetBSD, and haven't found a good way yet to
determine memory use totals (including swap) for free/in-use memory on my
NetBSD server.  I can run top, but I'd like a quick single-line output
method, if one exists.  When I run vmstat I don't see swap listed
separately (BTW the memory numbers are listed with no white-space between
them (I have 512MB phys) so it's difficult to read).

If I'm reading the man-page for vmstat(8) correctly, "avm" is used memory
and "fre" is free memory (in 1k blocks).  Therefore, the output below says
I have 22M used and 430M free - is that correct?  How does swap factor into
that?

% vmstat 
procs   memory     page                       disks         faults
cpu
r b w   avm   fre  flt  re  pi   po   fr   sr f0 c0 s0 m0   in   sy  cs us sy id
1 0 0 22528430472    6   0   0    0    0    0  0  0  2  0 1028   62   5 0  0 100
%

I can also do "sysctl hw" and see total physical memory, but I don't see a
way to list swap (other than with disklabel, which doesn't tell me if the
swap is in-use or not).

What I'm looking for is something like the "free" command in Linux.

Thanks for any suggestions,
-bp
--
# bryan_at_darkforest_dot_org
# Software Engineer