Skip to contentSkip to conversation

Posible memory leak!?

DISCUSSION Boris Kurktchiev 3 participants 10 messages May 13, 2003 – May 16, 2003

lore
Share & tools
lore
#0 lore raw

top - 11:03:41 up 4 min, 1 user, load average: 0.12, 0.20, 0.09

Tasks:  60 total,   1 running,  58 sleeping,   0 stopped,   1 zombie
Cpu(s):   8.3% user,   2.3% system,   0.0% nice,  89.4% idle
Mem:    385904k total,   173996k used,   211908k free,    14244k buffers
Swap:   128512k total,        0k used,   128512k free,    86732k cached

this is what the machine used to look like.

this is what happens when the machine has run for about 3 hours, and during that time I have had Netbeans and Day Of Defeat(wine) running for about 15 minutes.

top - 14:14:49 up 2:31, 1 user, load average: 0.03, 0.04, 0.01

Tasks:  60 total,   2 running,  57 sleeping,   0 stopped,   1 zombie
Cpu(s):   2.7% user,   0.3% system,   0.0% nice,  97.0% idle
Mem:    385904k total,   261368k used,   124536k free,    16736k buffers
Swap:   128512k total,     8768k used,   119744k free,   175476k cached

if i leave the machine on, and say I start transcoding something.. the RAM would not be touched and the swap usage would shoot up to 95%.

#1 lore raw
Quoted 18 lines · you

top - 11:03:41 up 4 min,  1 user,  load average: 0.12, 0.20, 0.09
Tasks:  60 total,   1 running,  58 sleeping,   0 stopped,   1 zombie Cpu(s):   8.3% user,   2.3% system,   0.0% nice,  89.4% idle
Mem:    385904k total,   173996k used,   211908k free,    14244k buffers
Swap:   128512k total,        0k used,   128512k free,    86732k cached

this is what the machine used to look like.

this is what happens when the machine has run for about 3 hours, and during that time I have had Netbeans and Day Of Defeat(wine) running for about 15 minutes.

top - 14:14:49 up  2:31,  1 user,  load average: 0.03, 0.04, 0.01
Tasks:  60 total,   2 running,  57 sleeping,   0 stopped,   1 zombie Cpu(s):   2.7% user,   0.3% system,   0.0% nice,  97.0% idle
Mem:    385904k total,   261368k used,   124536k free,    16736k buffers
Swap:   128512k total,     8768k used,   119744k free,   175476k cached

Quoted 3 lines

if i leave the machine on, and say I start transcoding something.. the RAM would not be touched and the swap usage would shoot up to 95%.

So far I see nothing abnormal. My current top:

09:51:53 up 16:40, 1 user, load average: 0.02, 0.02, 0.00 56 processes: 55 sleeping, 1 running, 0 zombie, 0 stopped

CPU states:  0.2% user,  0.4% system,  0.0% nice,  0.0% iowait, 99.3% idle
Mem:   124616k av,  114444k used,   10172k free,       0k shrd,       4k buff
        53088k active,              46836k inactive

Swap: 76792k av, 1804k used, 74988k free 53632k cached

Can you show "top b n1" (unabridged) and "cat /proc/meminfo", "cat /proc/slabinfo" of the "swap usage shoot up to 95%" event?
--
vda

#2 lore raw
Quoted 10 lines

09:51:53 up 16:40, 1 user, load average: 0.02, 0.02, 0.00 56 processes: 55 sleeping, 1 running, 0 zombie, 0 stopped

CPU states:  0.2% user,  0.4% system,  0.0% nice,  0.0% iowait, 99.3% idle
Mem:   124616k av,  114444k used,   10172k free,       0k shrd,       4k

buff 53088k active, 46836k inactive
Swap: 76792k av, 1804k used, 74988k free 53632k
cached

Can you show "top b n1" (unabridged) and "cat /proc/meminfo", "cat /proc/slabinfo" of the "swap usage shoot up to 95%" event?

heh this is very interesting.... top b n1 reports this:
top - 10:08:24 up 16:36, 2 users, load average: 0.16, 0.19, 0.08

Tasks:  62 total,   1 running,  60 sleeping,   0 stopped,   1 zombie
Cpu(s):  12.3% user,   5.1% system,   0.0% nice,  82.6% idle
Mem:    385904k total,   381572k used,     4332k free,   137244k buffers
Swap:   128512k total,    20012k used,   108500k free,   126168k cached

while gkrellm reports that my RAM used is 95MB. now this is interesting....

here is the /proc/meminfo:
total: used: free: shared: buffers: cached:

Mem:  395165696 389582848  5582848        0 141422592 138055680
Swap: 131596288 20623360 110972928
MemTotal:       385904 kB
MemFree:          5452 kB
MemShared:           0 kB
Buffers:        138108 kB
Cached:         127324 kB
SwapCached:       7496 kB
Active:         181268 kB
Inactive:       132244 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       385904 kB
LowFree:          5452 kB
SwapTotal:      128512 kB
SwapFree:       108372 kB

and here is /proc/slabinfo:
slabinfo - version: 1.1

kmem_cache            57     72    108    2    2    1
ip_conntrack           3     24    320    1    2    1
tcp_tw_bucket          0     30    128    0    1    1
tcp_bind_bucket        4    112     32    1    1    1
tcp_open_request       0      0     64    0    0    1
inet_peer_cache        0      0     64    0    0    1
ip_fib_hash           14    112     32    1    1    1
ip_dst_cache          30     40    192    2    2    1
arp_cache              3     30    128    1    1    1
urb_priv               3     59     64    1    1    1
blkdev_requests     1024   1050    128   35   35    1
dnotify_cache        125    169     20    1    1    1
file_lock_cache        7     42     92    1    1    1
fasync_cache           1    202     16    1    1    1
uid_cache              1    112     32    1    1    1
skbuff_head_cache    128    220    192   11   11    1
sock                 117    145    768   26   29    1
sigqueue               0     29    132    0    1    1
kiobuf                 0      0     64    0    0    1
cdev_cache            19     59     64    1    1    1
bdev_cache             6     59     64    1    1    1
mnt_cache             19     59     64    1    1    1
inode_cache        45164  59479    512 8497 8497    1
dentry_cache       20481  62910    128 2097 2097    1
filp                1262   1290    128   43   43    1
names_cache            0      2   4096    0    2    1
buffer_head        94915  97440    128 3248 3248    1
mm_struct             47     60    192    3    3    1
vm_area_struct      2479   2910    128   90   97    1
fs_cache              46     59     64    1    1    1
files_cache           46     54    448    6    6    1
signal_act            51     57   1344   18   19    1
size-131072(DMA)       0      0 131072    0    0   32
size-131072            0      0 131072    0    0   32
size-65536(DMA)        0      0  65536    0    0   16
size-65536             2      2  65536    2    2   16
size-32768(DMA)        0      0  32768    0    0    8
size-32768             4      4  32768    4    4    8
size-16384(DMA)        0      0  16384    0    0    4
size-16384             9     11  16384    9   11    4
size-8192(DMA)         0      0   8192    0    0    2
size-8192              5     20   8192    5   20    2
size-4096(DMA)         0      0   4096    0    0    1
size-4096             79     95   4096   79   95    1
size-2048(DMA)         0      0   2048    0    0    1
size-2048             10     14   2048    5    7    1
size-1024(DMA)         0      0   1024    0    0    1
size-1024             70     96   1024   18   24    1
size-512(DMA)          0      0    512    0    0    1
size-512              65     80    512   10   10    1
size-256(DMA)          0      0    256    0    0    1
size-256              49     75    256    4    5    1
size-128(DMA)          2     30    128    1    1    1
size-128             883    930    128   30   31    1
size-64(DMA)           0      0     64    0    0    1
size-64             2791   2891     64   49   49    1
size-32(DMA)          36     59     64    1    1    1
size-32              414    472     64    8    8    1
#3 lore raw
Quoted 7 lines · Boris Kurktchiev

heh this is very interesting.... top b n1 reports this:
top - 10:08:24 up 16:36, 2 users, load average: 0.16, 0.19, 0.08

Tasks:  62 total,   1 running,  60 sleeping,   0 stopped,   1 zombie
Cpu(s):  12.3% user,   5.1% system,   0.0% nice,  82.6% idle
Mem:    385904k total,   381572k used,     4332k free,   137244k
buffers Swap:   128512k total,    20012k used,   108500k free,  

126168k cached

Typical. So what makes you think kernel leaks memory?

BTW, which version of procps do you have? Mine is 2.0.10, 2.0.11 already exists.

Quoted 2 lines

while gkrellm reports that my RAM used is 95MB. now this is interesting....

gkrellm must be subtracting something from MemTotal trying to account for fact that large part of RAM is used as a cache. You may consult its source.
--
vda

#4 lore raw
Quoted 10 lines · Denis Vlasenko
Quoted 7 lines · Boris Kurktchiev

heh this is very interesting.... top b n1 reports this:
top - 10:08:24 up 16:36, 2 users, load average: 0.16, 0.19, 0.08

Tasks:  62 total,   1 running,  60 sleeping,   0 stopped,   1 zombie
Cpu(s):  12.3% user,   5.1% system,   0.0% nice,  82.6% idle
Mem:    385904k total,   381572k used,     4332k free,   137244k
buffers Swap:   128512k total,    20012k used,   108500k free,

126168k cached

Typical. So what makes you think kernel leaks memory?

well the fact that before my swap was never used, and now .... I need to transcode something so I can show you how all swap is being used and non of the RAM (thus making programs run much slower, as is the case with transcode).

Quoted 2 lines

BTW, which version of procps do you have? Mine is 2.0.10, 2.0.11 already exists.

I believe I have 2.0.10.

Quoted 3 lines

gkrellm must be subtracting something from MemTotal trying to account for fact that large part of RAM is used as a cache. You may consult its source.

No... I forgot to tell it to count cache and buffers...

#6 lore raw

The kernel is miscalculating my RAM...

In reply to Denis Vlasenko

ok here is what dmesg shows:
384MB LOWMEM available.

then further down:
Memory: 385584k/393216k available (2010k kernel code, 7244k reserved, 597k data, 128k init, 0k highmem)

now how is the little 38.../39... possible?

and then top shows this:
Mem: 385712k total

this again is different than the others...

and finaly gkrellm is telling me that I have only 377 mb actually recognized out of the 384mb that the kernel detected above...

So the question is where does my 7mb go, why that weird 38.../39 difference and why does top report another different value.

#7 lore raw

Re: The kernel is miscalculating my RAM...

Quoted 7 lines · Boris Kurktchiev

ok here is what dmesg shows:
384MB LOWMEM available.

then further down:
Memory: 385584k/393216k available

now how is the little 38.../39... possible?

384 * 1024 * 1000 = 393216000

Signature · 4 lines
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: [email protected]
#8 lore raw

Re: The kernel is miscalculating my RAM...

Quoted 10 lines · Chris Friesen
Quoted 7 lines · Boris Kurktchiev

ok here is what dmesg shows:
384MB LOWMEM available.

then further down:
Memory: 385584k/393216k available

now how is the little 38.../39... possible?

384 * 1024 * 1000 = 393216000

ahh so I am reading it wrong... ok but where is the 7mbs going? I think I amreading it right this time... and it says that it only uses 385584k as opposed to the full 393216k... btw the same thing happens with swap there are only 2mbs eaten up from it though... (I have 128mb and I get only 127mb)

#9 lore raw

Re: The kernel is miscalculating my RAM...

In reply to Chris Friesen
Quoted 10 lines · Chris Friesen
Quoted 7 lines · Boris Kurktchiev

ok here is what dmesg shows:
384MB LOWMEM available.

then further down:
Memory: 385584k/393216k available

now how is the little 38.../39... possible?

384 * 1024 * 1000 = 393216000

blah someone already answered my question about the missing 7mbs... is there a doc that tell swhy the kernel reserves that much memory?

#5 lore raw
In reply to Boris Kurktchiev
Quoted 6 lines · Boris Kurktchiev
Quoted 1 line

Typical. So what makes you think kernel leaks memory?

well the fact that before my swap was never used, and now .... I need to transcode something so I can show you how all swap is being used and non of the RAM (thus making programs run much slower, as is the case with transcode).

Well there might be problems with kernel being too swap-happy. I.e. it swaps out application pages but keeps less precious cache pages. These problems are not that easy to debug (How do one prove that kernel swaps out 'wrong' pages? What is 'wrong'? It's kind of subjective).

Quoted 4 lines
Quoted 2 lines

BTW, which version of procps do you have? Mine is 2.0.10, 2.0.11 already exists.

I believe I have 2.0.10.

No. 2.0.10 top printout look different:

11:44:00 up 1 day, 18:52, 1 user, load average: 0.25, 0.29, 0.23
63 processes: 60 sleeping, 3 running, 0 zombie, 0 stopped
CPU states: 41.8% user, 3.9% system, 0.0% nice, 0.0% iowait, 54.1% idle
Mem: 124616k av, 120448k used, 4168k free, 0k shrd, 4k buff

        87172k active,              18536k inactive

Swap: 76792k av, 21820k used, 54972k free 55944k cached
--
vda