I fear a kernel memory leak

Albrecht Dreß yellowdog-general@lists.terrasoftsolutions.com
Sun Jan 12 05:21:01 2003


Don't worry, that's no leak... Linux uses free memory for io buffers and 
disk cache, but this is shown as "used memory" when running "free" or "cat 
/proc/meminfo". When an application is started which uses a lot of ram, 
the kernel frees parts of this memory. So you end up with a memory usage 
well above 90%, but this is **not** a bug/problem. It just makes your 
system (io) a lot faster.

Hth, Albrecht.


Am 12.01.03 04:09 schrieb(en) jwalton@hotpop.com:
> I recently installed YDL-2.3 on a PBG3 (Pismo) and am loving it.
> 
> However, even with 640MB of ram, it looks like I'm running out of memory!
> When watching /proc/meminfo, just sleeping and waking the machine
> repeatedly seems to permanently use up some memory.  [and large chunks of
> memory disappear at other times too]
> 
> On my first boot, /proc/meminfo claims that I'm using about 100MB.  After
> a
> day of light usage, it says 400MB!
> 
> As a double-check, I ran ps, got the rsize column, and added it all up.
> The net result shows about 64MB used, whereas /proc/meminfo now claims
> 410MB used.  I've included the output below.
> 
> I don't see any mention in the ps output for memory allocated by the
> kernel, so obviously I can expect some discrepancy... but not 350MB
> worth!
> Is there some way to find out what the kernel has allocated to where?
> 
> Jonathan
> 
> [Note 1: I'm not entirely confident of the rsize output.  The ps man page
> claims vsize is in units of bytes, and vsize/rsize are roughly the same
> outputs...  but it has to be kB!  I also don't know how it counts shared
> pages and the like.  But in any case, that's what I see.]
> 
> [Note 2: I've definitely installed some nonstandard/newer versions of
> some
> things, so there's a chance this is due to some mods I've done to the
> stock
> system... but even so I'd love help in trying to figure out what and
> why.]
> 
> 
>     $ cat memusage
> 	cat /proc/meminfo
> 
> 	echo "0" > /tmp/calc
> 	ps -A -orsz --no-headers | sed -e "s~\(.*\)~\1 + ~" >> /tmp/calc
> 	echo "p" >> /tmp/calc
> 	dc /tmp/calc
> 	rm /tmp/calc
> 
>     $ ./memusage
> 		total:    used:    free:  shared: buffers:  cached:
> 	Mem:  656564224 410882048 245682176        0 18911232 240668672
> 	Swap: 67100672        0 67100672
> 	MemTotal:       641176 kB
> 	MemFree:        239924 kB
> 	MemShared:           0 kB
> 	Buffers:         18468 kB
> 	Cached:         235028 kB
> 	SwapCached:          0 kB
> 	Active:         193592 kB
> 	Inactive:        88804 kB
> 	HighTotal:           0 kB
> 	HighFree:            0 kB
> 	LowTotal:       641176 kB
> 	LowFree:        239924 kB
> 	SwapTotal:       65528 kB
> 	SwapFree:        65528 kB
> 	63216
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
> 
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Albrecht Dreß  -  Johanna-Kirchner-Straße 13  -  D-53123 Bonn (Germany)
        Phone (+49) 228 6199571  -  mailto:albrecht.dress@arcor.de
_________________________________________________________________________