please educate me on memory usage

Gregor Mosheh stigmata_blackangel at
Fri Sep 24 10:11:17 PDT 2004

I was looking at my top output and was surprised to
see that the bulk of my 512 MB of memory was in use,
since the server really has fairly little running.
It's not a problem, but I was wanting some
clarification on where this memory was being used, for
my own education.

The original goal was that I had figured that a lot of
memory would be unused since so little is running, and
perhaps I could allocate some more to Postgres.
Apparently nowt, but I don't quite understand all the
intricacies of what *is* using my memory.

35 processes:  1 running, 34 sleeping
CPU states:  0.0% user,  0.0% nice,  0.0% system, 
0.0% interrupt,  100% idle
Mem: 158M Active, 207M Inact, 80M Wired, 20M Cache,
60M Buf, 33M Free
Swap: 2000M Total, 6848K Used, 1994M Free

So, 158 MB of memory in use. Does that include
anything other than process' memory, e.g. shared
memory, kernel memory, some of the fs buffer? If I add
up the VSZ column from 'ps aux' I get 110 MB.

The server's only processes of interest are MySQL,
Postgres, and Apache httpd. There are cron, sendmail,
etc. but these are all <1M usage according to both top
and ps.

MySQL has VSZ 38 MB and RSS 4 MB.

Postgres (incl stats collectors) has VSZ 25 MB and RSS
<1 MB. There's also the shared memory: ipcs agrees
with my postgresql.conf settings: 2 MB of shared
memory buffers.

Apache 1.3 has 15 processes, each using 3.6 MB VSZ and
1.5 MB RSS. I was of the impression that the bulk of
this memory was shared with the parent process, no?

So where's the rest of the memory going?

The 80M Wired is interesting, since I don't know where
it's going. I presume that PG's 2 MB of shared buffers
are wired (though I saw an email today that implied
otherwise), but how could I track down the rest of it?

Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!

More information about the freebsd-questions mailing list