Subject: Re: 8 octets aligned data with malloc ?
To: Manuel BOUYER <bouyer@antioche.lip6.fr>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: tech-kern
Date: 10/16/1997 01:11:02
> Chris Torek pointed out that the 4.4bsd malloc always return memory aligned
> on the min of ((smaller ^2 > size), pagesize), because of the way he manages
> memory chunks that are smaller than pagezise. If so this could be enough for
> me, as I malloc memory size which are multiple of 8 bytes. Does someone knows
> if NetBSD's malloc behave like that ?

Yes.

The sparc's pmap and dvma code has relied on this for ages (though it no
longer does today), e.g. allocating page table memory that needs come
in chunks of 256 bytes and must also be 256-byte aligned;  malloc(256) is
good enough for this if you know malloc() works..

-pk