Scyld: memory leak or just caching?

Mike Weller weller at zyvex.com
Wed Jun 27 15:33:35 PDT 2001


Ok, this makes sense.  I found that looking in /proc/meminfo provides
more useful information about the buffer and cache memory.  I reran my
test using /proc/meminfo instead of "free", and I'm curious as to why
the "buffer/cache" #s were unchanged after running the "test app":

[root at beowulf ~]# bpsh 2 egrep "total|^Mem:" /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  1610125312 1004892160 605233152        0 872271872 18092032

...ok, 872M buffered, 18M cached, 114M actually used...
  (perhaps beostatus could have another column for  non-buffered/cached ram)

[root at beowulf ~]# bpsh 2 /home/malloc &
[1] 23276

root at beowulf /root # bpsh 2 ps -wleaf|grep -i malloc
040 T root       193    15  0  64   0    - 25871 109ec7 Jul12 ?        00:00:00 /home/malloc

... ok, 100M is allocated.

[root at beowulf ~]# bpsh 2 egrep "total|^Mem:" /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  1610125312 1004965888 605159424        0 872271872 18092032

... it didn't drop. let me try another node:

[root at beowulf ~]# bpsh 3 egrep "total|^Mem:" /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  1610125312 107184128 1502941184        0 52342784 18288640
 
[root at beowulf ~]# ( bpsh 3 /home/malloc ) &
[1] 23422

[root at beowulf ~]# bpsh 3 egrep "total|^Mem:" /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  1610125312 107286528 1502838784        0 52342784 18288640

...again, used went up 100k. i expected buffered to drop 100000000.

-Mike 

Sean wrote:
> On Wed, 27 Jun 2001, Mike Weller wrote:
> 
> > Sean wrote:
> > > Sounds like just caching to me.  However, if you want to double check,
> > > write a simple program that malloc()'s about 100M, bpsh it over there
> > > and see what happens.
> > 
> > Ok, I wrote a program to allocate 100M of RAM.  "ps -leaf" reports
> > 100M used by the program (taking SZ * 4096k/page).  However, "free"
> > reports an increase of only 100k, and no swap was used.  Does the

> This indicates that the usage you were seeing was just disk cache.  The
> kernel automatically caches data that you read off the disk into ram so
> that the next time you make the request, you don't actually have to use
> the disk and thus get it much faster.  As part of this, when you need to
> use more ram, it automagically shrinks the size of the cache its using
> so that there will be enough space for the memory you want to allocate.

-- 
Michael J. Weller, M.Sc.               office: (972) 235-7881 x.242
weller at zyvex.com                         cell: (214) 616-6340
Zyvex Corp., 1321 N Plano           facsimile: (972) 235-7882    
Richardson, TX 75081                      icq: 6180540





More information about the Beowulf mailing list