I think I have a memory leak in 2.3.x

Jay Thorne (jay@kesoftware.com)
Wed, 23 Jun 1999 14:03:51 -0700


But I'm still trying to prove it.

My system is very simple. There is an ISA based
sound card, a tulip net card and the motherboard is an ALI 1543. Cpu is
Cyrix M2. I was using a tool to set up some registers on the M2 for write
allocation and I've turned that off. I had a poorly set up system in that
kerneld was running on 2.2 and it was creating a message queue that
ipcs was puking on. I'm fairly certain my system is setup correctly now.
With the newer kernels update is no longer necessary, yes?

When I run a full X session with various tools and a lot o netscaping
around, a lot of xterms and such, when I exit back to a shell and go to
runlevel 1, ie single user, the maximum amount of resident set size a
process (*) can manage to get is around 38 Megs on my 64M system. My
simple memory allocator runs slow enough that the kswapd and the other
memory reclaiming functions have lots of time to work.

This process runs up until swap is exhausted and then gracefully exits
with a perl Out of memory error.

Then the used and free memory as reported by top show oddly
inconsisistent numbers. The used memory usually reports 20megs used, while
a quick add of shared + buffer + cache + the rss's of all the processes
counts up to about 4megs.

If I clean boot into single user, I can get about 54 megs RSS. Hmm, 16megs
difference. Is that significant?

I've done alt-sysrq-M until I'm blue in the face and I've checked on module
memory allocation and even reduced the open file and inode limits. I've
checked for rogue shm areas, and there are none.

What I cannot understand is where that memory could possibly have gone. Is
my test far too naive for words? Is there some mechanism that I do not
understand at work here?

* (using a simple memory allocator in perl, ie perl -e 'while (1) {$mem.="a
bunch of text";}' &

This is one of the incidents. Its in kernel 2.3.4. I had just run the perl
thingie, and it had just died. Notice free pages are 39012, instead of
someting like 54000

Jun 19 21:47:59 home kernel: SysRq: Show Memory
Jun 19 21:47:59 home kernel: Mem-info:
Jun 19 21:47:59 home kernel: Free pages: 39012kB
Jun 19 21:47:59 home kernel: ( Free: 9753 (128 256 384)
Jun 19 21:47:59 home kernel: 1377*4kB 1608*8kB 692*16kB 219*32kB 32*64kB
2*128kB 1*256kB 0*512kB 0
*1024kB 0*2048kB = 39012kB)
Jun 19 21:47:59 home kernel: Swap cache: add 49976, delete 49841, find
13690/40036
Jun 19 21:47:59 home kernel: Free swap: 124232kB
Jun 19 21:47:59 home kernel: 16384 pages of RAM
Jun 19 21:47:59 home kernel: 563 reserved pages
Jun 19 21:47:59 home kernel: 127 pages shared
Jun 19 21:47:59 home kernel: 135 pages swap cached
Jun 19 21:47:59 home kernel: 25 pages in page table cache
Jun 19 21:47:59 home kernel: Buffer memory: 1316kB
Jun 19 21:47:59 home kernel: Buffer heads: 1352
Jun 19 21:47:59 home kernel: Buffer blocks: 1316
Jun 19 21:47:59 home kernel: Buffer hashed: 1313
Jun 19 21:47:59 home kernel: CLEAN: 1313 buffers, 70 used (last=167), 0
locked, 0 protected, 0
dirty
Jun 19 21:47:59 home kernel: Networking buffers in use : 32
Jun 19 21:47:59 home kernel: Total network buffer allocations : 5319795
Jun 19 21:47:59 home kernel: Total failed network buffer allocs : 0
Jun 19 21:47:59 home kernel: IP fragment buffer size : 0

-- 
Jay Thorne  jay@kesoftware.com   KE Software
http://www.kesoftware.com

- 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.tux.org/lkml/