[NTLUG:Discuss] Two questions..
Steve Baker
sjbaker1 at airmail.net
Mon Dec 20 22:47:40 CST 1999
> My second question is about memory usage. Over the weekend, I installed some
> additional memory, and my machine has 96M of ram now. Top reports different
> memory usage like shared memory, used, etc. Here is my question: before
> running programs such as Netscape, staroffice, etc, I monitor my "used
> memory" as reported by "top". Then I run those programs, and "top" obviously
> shows an increase in the used memory, but when I quit these programs, memory
> usage goes down but still more than what it used to be before running the
> program, and this pattern keeps repeating itself. What does it really mean?
> Why doesn't it go back to the value it was before? Am I interpreting what
> "top" reports incorrectly?
If you run 'free -t' (shows you total memory usages) you'll get something
like this:
total used free shared buffers cached
Mem: 63060 60900 2160 40716 1880 32848
-/+ buffers/cache: 26172 36888
Swap: 100796 284 100512
Total: 163856 61184 102672
>From the 'Mem:' line of this report, it *looks* like this machine is
nearly out of memory (only 2Mb left out of 64Mb). But realise that
Linux uses unused memory to cache recent disk accesses. As soon as
a program needs more memory than is 'free', Linux will drop things
out of the disk cache and give that memory to the program.
Looking at the next line of the report (which tells you how things
are when you ignore caching and other disposable buffers), you can
see that I really have over 36Mb free (MUCH healthier). Linux is using
about half of my memory as disk cache...and I could run a program
that needs about 36Mb before we'd start swapping.
Clearly this is a good thing - if the memory isn't needed for anything
else, Linux might as well use it to cache something - and given how
slow disk drives are, caching disk sectors is good.
The 'Swap:' line of the report shows how much disk space is available
for swapping out programs that have run out of space...another 100Mb
or so is free there - so a program could actually allocate about
137Mb before actually "running out" of memory....the system might
be running at a crawl by then though!
Avid memory watchers can run 'mem' which gives continuous readouts
of more things than you'll ever care about - or 'xosview' which does
the same thing with cute graphics.
--
Steve Baker http://web2.airmail.net/sjbaker1
sjbaker1 at airmail.net (home) http://www.woodsoup.org/~sbaker
sjbaker at hti.com (work)
More information about the Discuss
mailing list