When I use the "top" command on my Red Hat 7.2 machine, it tells me that ~3.9 out of 4.0 gigs of RAM are in use, and that there's about 135meg free.
When I use the "ps" command, however, to list all processes and their memory utilization, the list only adds up to about 650megs.
Is this expected behavior, or is there something going on that should be cause for concern? I read that Linux will use free RAM to cache frequently used files from the disk, could that account for the "missing" RAM utilization?
Thanks!
IVR Avenger
Answer
Your guess is most likely correct.
The "free memory" number given by top does not include what is used for the filesystem cache or buffers. The memory allocated to filesystem cache is free in that if an process needed some of it, it could easily be made available, but top will not show you this.
free -m
will give you a better idea of how much memory your processes are actually using (in MB), on the "-/+ buffers/cache" line.
Of course, it still won't likely equal your calculations based on the output of ps exactly, because calculating memory usage in Linux is tricky, especially around shared memory.
In the following example, 1287MB is much more accurate as a view of free memory than 31MB.
$ free -m
total used free shared buffers cached
Mem: 2002 1970 31 0 48 1207
-/+ buffers/cache: 714 1287
Swap: 1027 3 1023
Comments
Post a Comment