View previous topic :: View next topic |
Author |
Message |
Martin Tux's lil' helper
Joined: 12 Jun 2002 Posts: 96 Location: Vancouver, Canada
|
Posted: Sat Jul 06, 2002 8:28 am Post subject: Nasty memory usage |
|
|
This has been bugging me for a while - I'm getting some nasty memory usage and can't figure out where it's being eaten up. top reports:
512 av, 453 used, 60 free. 0 swap
Some quick addition of proceses adds up to only 170 used. What gives? Is this normal? Does linux just allocate all the memory like that?
(Please explain to this ex MS whore)
Thanks. |
|
Back to top |
|
|
ElCondor Guru
Joined: 10 Apr 2002 Posts: 520 Location: Vienna, Austria, Europe
|
Posted: Sat Jul 06, 2002 8:41 am Post subject: |
|
|
linux uses all the memory available, if there are no programs loaded ("used memory") it will be filled up with "buffers" and "cache" where "buffers" is like the usual disk cache and "cache" is keeping program code in the memory of programs you have run before.
depending on the kernel, it may also start to swap while there is still free memory! this has been changed by linus at about 2.4.10 and was heavily discussed (and flamed ). the idea is, that a programm starts to swap out it's code when cpu/disk are idle, and when it comes to the point that another program really needs more memory than currently available, the first loaded program just frees the ram and uses it's already swaped data, which can speed things up quite a lot .. but it's terrible on notebooks with enough memory.
PS: does anyone know whether the gentoo-kernels are using the -ac patches to refrain from swapping?
* ElCondor pasa * _________________ Here I am the victim of my own choices and I'm just starting! |
|
Back to top |
|
|
trythil Tux's lil' helper
Joined: 06 Jun 2002 Posts: 123 Location: RHIT, Terre Haute, IN, USA
|
Posted: Sat Jul 06, 2002 9:23 am Post subject: |
|
|
You may want to try using free instead of top...top does a notoriously bad job at reporting memory quantities, mostly because it's too stupid to accurately represent things. In particular, multithreaded programs will make top go nuts (and you as well, if you don't know how to read the output).
Here's an example:
Code: |
trythil@beleriand trythil $ free
total used free shared buffers cached
Mem: 126660 96520 30140 0 0 68284
-/+ buffers/cache: 28236 98424
Swap: 329324 23748 305576
|
In that above figure, I've got 28.2 MB of physical RAM used, and 98.4 MB free. It's not 96.5 MB used and 30.1 MB free -- a lot of that is taken up by buffers and caching, which are automatically flushed/replaced by the kernel. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|