[fpc-pascal] memory allocation of dynamic array

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Jan 2 02:36:15 CET 2005


On 23 Sep 2007, at 05:18, Marc Santhoff wrote:

> My question:
> In which cases will it happen that the memory of a dynamic array is
> fragmented into multiple non-contiguous blocks?

Even if the current implementation allocates dynamic arrays always in  
one block (I think it does, but I'm not certain), there is probably  
no guarantee it will stay that way forever (and counting on that may  
consequently break your program in the future).

Counting on implementation details of opaque entities (such as set  
formats, anything regarding reference counted types such as when  
references are added or removed and when how many references will  
exist, rtti format, code generation details such as evaluation order  
of parameters or operands, memory manager allocation behaviour, ...)  
is almost 100% guaranteed to break your code at one point or another  
in time (and often at multiple points in time).


Jonas



More information about the fpc-pascal mailing list