sbrk(2) question

Boyd Roberts boyd at necisa.ho.necisa.oz.au
Tue Mar 19 10:39:03 AEST 1991


In article <4319 at skye.ed.ac.uk> richard at aiai.UUCP (Richard Tobin) writes:
>
>There is no reason for sbrk() and malloc() to "not mix" provided you're
>careful not to free memory you didn't allocate.  On the other hand,
>there's not usually a good reason to not just use malloc().
>

Well there may be no reason, but in reality most malloc(3) implementations
assume that it and no one else has called sbrk(2).  I'm sure that pre-System V
implementations were known to break if you mixed sbrk(2) and malloc(3).

I could be wrong, but I know I've been burnt by this before.
Don't call sbrk(2) after malloc(3).  Core dumps assured.  


Boyd Roberts			boyd at necisa.ho.necisa.oz.au

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.questions mailing list