[NTLUG:Discuss] Two questions..

Steve Baker sjbaker1 at airmail.net
Tue Dec 21 22:57:14 CST 1999


"George E. Lass" wrote:
> 
> Steve Baker wrote:
> >
> > 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)
> 
> Steve,
> 
> Thanks for your explanation of the output of the "free" command.
> I never knew what the " -/+ buffers: " line meant.  Your example
> did bring to mind an additional question though.  Even without
> considering the amount of memory that the buffers are using, your
> example shows that there is 2160(K) of free memory, but also that
> there is 284(K) of used swap space.  Any idea why the swap space
> is being used when there is available free memory?

Well, you know, I was wondering that exact same thing.  I'm
guessing that at some stage over the past week, I *did* use
all of physical memory - so something got swapped out.  However,
if that something was some kind of daemon code or something else
that is never executing for some reason, then Linux would have
no reason to waste time swapping it back in again...hence, it's
still off on disk.

But that's only a guess.

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