[fpc-devel] StrDispose FreeMem with size

Micha Nelissen micha at neli.hopto.org
Fri Oct 13 09:59:00 CEST 2006


Daniƫl Mantione wrote:
> No, it is a concious decision and Delphi compatible. The TP heap manager 
> did not store the size of a block, so the size parameter was necessary. 
> It was also possible to free only parts of blocks.
> 
> This is not possible with the FPC heap manager, it frees the entire heap 
> block. So the size has no function.

Oh ok, I didn't know; thought it was like an assertion check. But why is 
there a FreeMemSize in the heap manager then ? It could've been:

function FreeMemSize(P: pointer; S: ptrint): ptrint;
begin
   { ignore S: cannot free blocks partially }
   Result := FreeMem(P);
end;

I think no recent heap manager can free blocks partially ?

Micha



More information about the fpc-devel mailing list