[fpc-devel] cmem Size Field

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Oct 19 10:43:43 CEST 2012


On 18 Oct 2012, at 20:10, Ewald wrote:

> In the cmem unit I see that there is always some extra room allocated
> where the size in bytes of the requested memory block is stored. Also I
> noticted that this size is never really used.
> 
> While I do see the point of the field (e.g. checking for right size
> parameter in FreeMemSize or some other debugging functionality), I do
> not see why this extra memory is needed always since the calls in the C
> library (malloc, free, realloc, calloc) do not need this kind of
> information.

As you explain, the FPC heap manager is what requires this information. The MemSize function is standard functionality of the FPC heap managers, and so is checking whether the correct size is specified when calling freemem(p,size).


Jonas


More information about the fpc-devel mailing list