free & memory use [was: Re: (no subject)]

Todd Denniston Todd.Denniston at ssa.crane.navy.mil
Tue Jan 13 15:08:03 UTC 2009


Rick Stevens wrote, On 01/12/2009 06:14 PM:
>   free reports the high-water mark of swap (the
> highest usage), not how much is being used NOW.  It won't be reset until
> a reboot occurs.
> 

While I agree with pretty much everything else you wrote, the above seems wrong.

I have a program used just to suck up memory, it uses every byte it allocates, 
and here is some output that makes me thing your above comment is at least not 
*fully* correct:

Before sucking memory:
$ free
              total       used       free     shared    buffers     cached
Mem:        514496     505936       8560          0      66156     139176
-/+ buffers/cache:     300604     213892
Swap:      1052248       9928    1042320

At maximum suckage:
$ free
              total       used       free     shared    buffers     cached
Mem:        514496     509396       5100          0       5368      13528
-/+ buffers/cache:     490500      23996
Swap:      1052248     521616     530632

Just after releasing all sucked memory:
$ free
              total       used       free     shared    buffers     cached
Mem:        514496      70536     443960          0       5360      14516
-/+ buffers/cache:      50660     463836
Swap:      1052248     191564     860684

After some other applications were called for, i.e., bring Thunderbird back to 
the foreground and start this reply:
$ free
              total       used       free     shared    buffers     cached
Mem:        514496     188460     326036          0       6504      51892
-/+ buffers/cache:     130064     384432
Swap:      1052248     189392     862856


As I recall updatedb will cause similar effects.
and _if_the_machine_has_sufficient_main_memory_ so that swap is not needed at 
the current time, issuing
/sbin/swapoff -a
/sbin/swapon -a
would reset the values free shows for swap usage, and
/sbin/swapon -s
could be educational before and after the above commands.

-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter




More information about the fedora-list mailing list