[fpc-devel] cmem not aligning memory

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Apr 8 15:12:06 CEST 2010


On 08 Apr 2010, at 15:05, C Western wrote:

> How about an alternative implementation, without the integer  
> recording size? I had a quick try at this - the only use of the  
> MemSize routine in fpc+lazarus seems to be in an optimization in  
> resizing strings. If this routine is adjusted to cope with MemSize  
> returning 0 to indicate "not known" then most applications should  
> work.

Having "most" applications work is a great recipe for annoying bug  
reports (and annoyed users).

> This implementation as the additional advantage that mixing malloc  
> and free's between C and Pascal then work.

That would indeed be nice, but I don't think it is feasible. Someone  
who values such functionality more than a full implementation of the  
memory manager can always install their own memory manager.

> PS: The CFreeMemSize seems to be incorrectly implemented - it does  
> not offset the pointer.

It calls CFreeMem, which does perform the adjustment.


Jonas



More information about the fpc-devel mailing list