Steven W McDougall wrote: > The align_1 parameter to mem_allocate() does not--as you might > think--control the alignment of the allocated block. Rather, it > controls the *size* of the allocated block, rounding it up to the next > multiple of the power of 2 indicated by align_1. This means that the > alignment of a block returned by mem_allocate() is dependent on the > *previous* calls to mem_allocate().
This problem has arisen because the buffer and string memory pools, which have different alignment rules, were combined back into a single pool. I am currently in favour of using a fixed alignment for everything, determined by the configuration process. This would be a minimum of sizeof(void *); some platforms might want more than that. There is also a longstanding theoretical bug in that the return pointer from the original call to the system memory allocator is not adjusted to the desired alignment. -- Peter Gibbs EmKel Systems