From owner-freebsd-hackers Fri Mar 24 08:43:46 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id IAA08752 for hackers-outgoing; Fri, 24 Mar 1995 08:43:46 -0800 Received: from cs.weber.edu (cs.weber.edu [137.190.16.16]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id IAA08746 for ; Fri, 24 Mar 1995 08:43:45 -0800 Received: by cs.weber.edu (4.1/SMI-4.1.1) id AA09409; Fri, 24 Mar 95 09:37:26 MST From: terry@cs.weber.edu (Terry Lambert) Message-Id: <9503241637.AA09409@cs.weber.edu> Subject: Re: is this reasonable? To: elh@p5.spnet.com (Ed Hudson) Date: Fri, 24 Mar 95 9:37:25 MST Cc: hackers@FreeBSD.org, elh@p5.spnet.com In-Reply-To: <199503240052.AAA15572@p5.spnet.com> from "Ed Hudson" at Mar 24, 95 00:52:11 am X-Mailer: ELM [version 2.4dev PL52] Sender: hackers-owner@FreeBSD.org Precedence: bulk > 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.