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

Re: Linux mem usage



On Thu, May 24, 2001, israel (srul) meron wrote about "Linux mem usage":
> I am running a Red Hat 7.1 release (Seawolf) kernel 2.4.2-2  (i tried also
> the new 2.4.4).
> 350mhz CPU ,384MB RAM , single processor.
> After Mem usage goes high ,  it never goes down  even if  all processes are
> stopped)    and also wether the SWAP was used or not.
> could it be due to the not so strong machine ? i cant see any connection
> between the 2.

Linux uses any unused memory space for caching disk pages, so that when you
run the same program over and over (this is very typical in a Unix environment
when using a shell, etc.) the kernel will only have to read the program's
pages from the hard-disk once. This is why after some time of system activity
it appears as if the entire memory is used.

But take a look at the output of the 'free' command (the following is just an
example on my machine):

$ free
             total       used       free     shared    buffers     cached
Mem:        126648     122072       4576          0       1728      74484
-/+ buffers/cache:      45860      80788
Swap:       265032      85852     179180


You probably looked and saw the 4576 and said that only 4M out of the toal
128M is free. Well, this is true, but most of that memory used is actually
in disk caching, which will be cleared the moment your applications actually
need more memory. In this example, 74484 (74M) of memory is used for caching.
The third line of the 'free' output, the "-/+ buffers/cache" line, shows how
much memory is really in use by applications (and not the kernel's cache),
in this case only 45M is used and 80MB is free.

-- 
Nadav Har'El                        |      Thursday, May 24 2001, 2 Sivan 5761
nyh@math.technion.ac.il             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |The two most common elements in the
http://nadav.harel.org.il           |universe are hydrogen and stupidity.

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il