[fpc-devel] cmem not aligning memory

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Apr 3 13:56:34 CEST 2010


On 03 Apr 2010, at 13:00, C Western wrote:

> I notice that the cmem unit does not align memory in the same way as the default unit - removing the cmem unit makes a factor of two difference in the speed of some double precision matrix code. (My system is i386). Inspecting the cmem unit indicates the issue is the extra bytes allocated for the count - is this really needed?

It is to be able to implement the same checking as the Pascal version has (give a run time error in case someone calls freemem(p,size) with the wrong size).

BSD variants have a malloc_size() function that could be used instead, but at least Solaris and Linux don't seem to have something similar.

> Or do we have to allocate more bytes for blocks that are a multiple of 8?

FPC's default memory manager even guarantees 16 byte alignment (for vectors).


Jonas


More information about the fpc-devel mailing list