Microport and SCO Xenix Memory Managment Problems
Tony Andrews
tony at wldrdg.UUCP
Tue Oct 28 04:15:14 AEST 1986
>From Tim Smith sdcrdcf!ism780c!tim
> sbrk has to behave funny because of program that assume a linear
> address space. Many program that want N bytes do the following:
>
> char * ptr;
> ptr = sbrk(0);
> brk(ptr+N);
>
> To make these work correctly, sbrk(0) has to return the start of
> the next segment.
Unfortunately, malloc wasn't fixed to properly deal with the
screwy behavior of brk and sbrk. For small malloc requests,
malloc asks for a 1K chunk and allocates from that. Each time it
decides to grab another 1K it gets it from a NEW segment. The
net effect is that malloc squanders segments and can run out
of memory because of a lack of LDT entries before it even comes
close to hitting other limits.
Tony Andrews
...!ihnp4!onecom!wldrdg!tony
Wildridge Consulting, Inc.
Boulder, CO
More information about the Comp.lang.c
mailing list