Date: Thu, 13 Apr 1995 05:37:54 +1000 From: Bruce Evans <bde@zeta.org.au> To: elh@p5.spnet.com, hackers@FreeBSD.org Subject: malloc Message-ID: <199504121937.FAA24223@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504121937.FAA24223>