Date: Fri, 24 Mar 95 9:37:25 MST From: terry@cs.weber.edu (Terry Lambert) To: elh@p5.spnet.com (Ed Hudson) Cc: hackers@FreeBSD.org, elh@p5.spnet.com Subject: Re: is this reasonable? Message-ID: <9503241637.AA09409@cs.weber.edu> In-Reply-To: <199503240052.AAA15572@p5.spnet.com> from "Ed Hudson" at Mar 24, 95 00:52:11 am
next in thread | previous in thread | raw e-mail | index | archive | help
> sbrk called with an arg of 1 (eg, sbrk(1)) > under fbsd2.x increments the brk by 1. > > under SunOS4.1.3, sbrk(1) increments the brk by 8, > and returns a result always double-word (8byte) > aligned. > > fbsd malloc, /usr/lib/src/libc/stdlib/malloc.c, > only aligns sbrk on its first call. Malloc should *always* return aligned objects meeting the most stringent access criteria for the machine. > i'm hazy about whether or not fbsd requires malloc > to have exclusive control of a programs brk values, > but in my reading of the man pages and this code, it > doesn't appear to be the case. if indeed malloc > is supposed to be able to co-exist with other routines > calling sbrk with >0 values, then i think that either > malloc has a latent bug, or sbrk is broken in its > behavior. Mixed use of sbrk and malloc is specificially disallowed, even on SunOs 4.1.3: ] WARNINGS ] Programs combining the brk() and sbrk() system calls and ] malloc() will not work. Many library routines use malloc() ] internally, so use brk() and sbrk() only when you know that ] malloc() definitely will not be used by any library routine. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9503241637.AA09409>