From owner-freebsd-hackers Wed Apr 12 12:41:01 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id MAA21552 for hackers-outgoing; Wed, 12 Apr 1995 12:41:01 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id MAA21537 for ; Wed, 12 Apr 1995 12:40:36 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id FAA24223; Thu, 13 Apr 1995 05:37:54 +1000 Date: Thu, 13 Apr 1995 05:37:54 +1000 From: Bruce Evans Message-Id: <199504121937.FAA24223@godzilla.zeta.org.au> To: elh@p5.spnet.com, hackers@FreeBSD.org Subject: malloc Sender: hackers-owner@FreeBSD.org Precedence: bulk > a while ago i encountered an 'application almost bug' wherein > sbrk(1) returns (old_mem+1). Some other unix's > (e.g., SunOS) return a double word aliged value. I think sbrk() should do what it is told, and callers of sbrk() should do any necessary rounding and aligning. malloc() should align page-sized objects to a page boundary and doubleword alignment is irrelevant for this. malloc() doesn't do this. Try: printf(""%p\n", malloc(0x1000)); printf(""%p\n", malloc(0x1000)); printf(""%p\n", sbrk(1)); printf(""%p\n", malloc(0x1000)); We should support i486 alignment checking so that misaligned pointers can be found easily. Last time I enabled it (4-5 years ago) it found too many problems, so I stopped using it. gcc generated misaligned "rep movsd" instructions for structs that don't require word alignment... Bruce