Memory Usage Stats

Jeremy Chadwick koitsu at FreeBSD.org
Thu Aug 21 20:16:57 UTC 2008


On Thu, Aug 21, 2008 at 02:05:50PM -0400, Sabeeh Baig wrote:
> I've been noticing never-before-seen highs in memory usage, since the
> last time I rebuilt world a bout a week ago.  I have 2GB of memory and
> 2GB of swap space.  According to top, a little over 1GB of memory is
> active, 70MB free, 300MB wired, and the rest inactive.  I also have
> 59MB of swap used.

The swap in use is fine; memory which is often untouched (e.g. allocated
but then not utilised for some time) is often swapped out to disk.

> If I close an application, the amount of active memory never decreases
> and the other stats don't change either.

I think you may be reading top output incorrectly, which is a common
problem these days.  I hope you're not assuming that the "Free" column
in top defines how much memory there is available for allocation on the
system.

> The active figure can't be right even now, as I only have
> Xfce, Xorg, screen, two zsh session, slurm, irssi, pidgin, mpd, ncmpc,
> and irssi running.  That's usually my normal session and usage has
> been better before I recompiled.

> Is it possible that top is displaying the wrong stats?

Possibly -- how exactly did you rebuild your system when you said you
"rebuilt world"?  Did you follow each and every step in src/Makefile,
including booting into single user, etc. etc.?

The reason I mention this is, lots of userland utilities rely on libkvm.
For example, you rebuilt your kernel (and the KVM structure within the
kernel changed due to CVS commits or whatever else), but you didn't
rebuild userland (e.g. libkvm still refers to the old KVM structure),
then you will see very odd numbers or possibly total breakage in top,
ps, systat, etc...

> Is there any other utility I could try?

systat, vmstat, and procstat (the latter only available if you're using
a fairly recent RELENG_7 or HEAD; and it may not be of much help here,
since it just provides a break-down of memory usage within a process)

> I've tried ps auxm, but that's not exactly what I'm looking for.

You could start by:

1) Stating if you're on i386 or amd64 -- it matters,
2) Providing top output (sorted by "res") before and after said
   rebuild,
3) Providing top output (sorted by "res") before and after you
   terminate a process that uses a large amount of memory.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |



More information about the freebsd-stable mailing list