Re: Some questions about linux kernel.

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Tue Mar 21 2000 - 08:47:00 EST


On Tue, 21 Mar 2000, Alan Cox wrote:

> > Malloc(), as stated before, just sets a new break address when it
> > runs out of heap. It keeps track of the heap, but not very carefully.
>
> Not any more. Modern mallocs are a lot smarter. They also use mmap for
> their backing store
>

Certainly not the C runtime library distributed by RedHat.
Script started on Tue Mar 21 08:41:09 2000
# cat xxx.c

main()
{
    for(;;)
        malloc(0x1000);
}

# gcc -o xxx xxx.c
# strace xxx
brk(0) = 0x80495c4
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("off == 0", O_RDONLY) = 3
mmap(0x72206369, 1668246629, 0x70797420, MAP_??? (0x5)|0x6c650060, 1634557798, 0x6e696863) = 0x4000c000
munmap(0x4000c000, 4096) = 0
mmap(0x65725f65, 774766700, PROT_READ|PROT_WRITE|PROT_EXEC|0x73797328, MAP_??? (0x4)|0x73706560, 942893359, 0x6c642f36) = 0x4000c000
mprotect(0x40097000, 74888, PROT_NONE) = 0
mmap(0x63616d2d, 1701734760, PROT_WRITE|PROT_EXEC|0x21006828, MAP_??? (0)|0x6e752220, 1701869669, 0x64657463) = 0x40097000
mmap(0x6e796420, 1667853665, 0x6c657220, MAP_??? (0xf)|0x74206360, 577073273, 0x656e7500) = 0x4009d000
close(3) = 0
mprotect(0x4000c000, 569344, PROT_READ|PROT_WRITE) = 0
mprotect(0x4000c000, 569344, PROT_READ|PROT_EXEC) = 0
SYS_136(0, 0x1, 0x4009c02c, 0xbffff75c, 0xbffff754) = 0
getpid() = 7126
brk(0) = 0x80495c4
brk(0x804a5dc) = 0x804a5dc
brk(0x804b000) = 0x804b000
brk(0x804d000) = 0x804d000
brk(0x804f000) = 0x804f000
brk(0x8051000) = 0x8051000
brk(0x8053000) = 0x8053000
brk(0x8055000) = 0x8055000
brk(0x8057000) = 0x8057000
brk(0x8059000) = 0x8059000
brk(0x805b000) = 0x805b000
brk(0x805d000) = 0x805d000
brk(0x805f000) = 0x805f000
brk(0x8061000) = 0x8061000
brk(0x8063000) = 0x8063000
brk(0x8065000) = 0x8065000
brk(0x8067000) = 0x8067000
brk(0x8069000) = 0x8069000
brk(0x806b000) = 0x806b000
brk(0x806d000) = 0x806d000
brk(0x806f000) = 0x806f000
brk(0x8071000) = 0x8071000
brk(0x8073000) = 0x8073000
brk(0x8075000) = 0x8075000
brk(0x8077000) = 0x8077000
brk(0x8079000) = 0x8079000
brk(0x807b000) = 0x807b000
brk(0x807d000) = 0x807d000
brk(0x807f000) = 0x807f000
brk(0x8081000) = 0x8081000
^C
# exit
exit
Script done on Tue Mar 21 08:41:31 2000

I do check these things out you know...

Cheers,
Dick Johnson

Penguin : Linux version 2.3.41 on an i686 machine (800.63 BogoMips).

-
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/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:32 EST