[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: newbie questions re: memory usage, leaks and troubleshooting



On Sun, Jul 15, 2001 at 08:53:32PM -0700, Kurt Lieber wrote:
> I'm running potato with Apache and MySQL and have noticed some memory
> problems that I'm not sure how to troubleshoot.  Basically, available memory
> keeps getting used up and not reclaimed.  Swap space doesn't seem to get
> used much, if at all.  Currently, free says:
> 
>                 total           used         free             shared
> buffers     cached
> Mem:       257952     103052     154900      32696      58040      25440
> -/+ buffers/cache:      19572        238380
> Swap:       658624         0           658624
> 
> But if I use top and manually add up all the values of the RSS field, I get
> something around 50MB.

What you're seeing is normal behaviour.  Run free again (I would say to
just look at the output above, but it's not very comprehensible with the
columns out of whack like that...) and pay attention to _all_ the column
headings.  Let's see if I can reconstruct your posted memory stats:

            total    used  free    shared   buffers  cached
Mem:       257952  103052  154900   32696     58040   25440
-/+ buffers/cache:  19572  238380
Swap:      658624       0  658624

There!  See the "buffers", and "cached" columns?  Ignore them for now.
If you're looking for real memory usage, the last two lines are what
matters.  You've only got 19572k + 32696k (which is roughly 50M -
sound familiar?) of _real_ memory usage.  The reaon you have 103052k
total memory usage is because your kernel sees all that extra RAM just
sitting there unused and starts using it for additional data buffers
(58040k) and for caching files (25440k) in order to improve performance.
Keeping this in memory doesn't hurt anything, since the memory used for
extra buffers and cache can just be declared to be available if a better
use for the RAM comes along.

The reason your memory "usage" stops at the limit of physical RAM and
never goes into swap is that swapping out cached disk files would lose
the benefit of caching it in the first place, so those pages are just
freed instead.



Reply to: