mystery memleak 2.0.x/2.1.11x

jeffml@pobox.com
Sat, 8 Aug 1998 07:37:19 +0900


What started out as what I thought was a memory leak in the es1370 sound
card module has turned into a complete mystery. Because I see it in both
2.0 and 2.1, it is probably something stupid I'm doing. I'm trying to
narrow it down and hoping someone can help me out.

Everytime I play an MP3 using any number of programs (splay/xaudio/mpg123) a
bit of my free memory drops. This is with es1370 compiled as module and in
kernel.

Using the memleak patches for 2.1.113, I dropped down to single user mode.
and looped a tiny mp3 with a bash 'while' (tried ash also, same effect).

As the loop continued, I used the shift-scrollLock combo to watch as the
free pages dropped and dropped. There is probably a good explaination for
it, but I found it interesting that for every loop, 1 of the largest pages
would be used (and 1 added to the second highest) until all pages were used.

So each loop's memory leak wasn't consistent, but instead depended on what
largest free page was available. In the end I would have ended up with only
4K pages left.

I'm not a kernel hacker, so this is probably explained by some algorithm
that I have no idea about. :-)

Needless to say I would run out of memory with about 5 minutes of looping
the mp3. I'd gladly supply more info (kernel config, ...) to figure this
out. 2.1.115 has the same leak, but I don't have a patch for memleak and
could only get that info with 2.1.113.

I've included before and afters of 'free' and also the diffs of dosum
(memleak) scripts. (ps auwwx was exactly the same as when I started)

command used: while true;do xaudio hmm.mp3 2>/dev/null;done
(it ran ~570 times before I stopped it)

ps auwwx:

USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
root 1 1.2 1.4 768 384 ? S 22:44 0:03 init
root 2 0.0 0.0 0 0 ? SW 22:44 0:00 (kflushd)
root 3 0.0 0.0 0 0 ? SW< 22:44 0:00 (kswapd)
root 68 0.0 1.4 768 384 1 S 22:45 0:00 init
root 69 0.0 3.5 1408 940 1 S 22:45 0:00 /bin/sh
root 7960 0.0 1.7 848 476 1 R 22:49 0:00 ps auwwx

free:

total used free shared buffers cached
Mem: 26516 4136 22380 1608 708 2164
-/+ buffers/cache: 1264 25252
Swap: 25196 0 25196

****

total used free shared buffers cached
Mem: 26516 24032 2484 1608 708 2572
-/+ buffers/cache: 20752 5764
Swap: 25196 0 25196

dosum diffs: (ones with more a couple changes, keep in mind 2.1.113 kernel)

652 buffer.c:1219
772 buffer.c:1219
161 buffer.c:1601
193 buffer.c:1601
164 dcache.c:501
181 dcache.c:501
164 dcache.c:505
181 dcache.c:505
273 filemap.c:1035
329 filemap.c:1035
186 filemap.c:310
228 filemap.c:310
66 filemap.c:732
70 filemap.c:732

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html