[fpc-pascal] memory allocation of dynamic array

Marc Santhoff M.Santhoff at t-online.de
Sun Sep 23 05:18:12 CEST 2007


Hi,

a while ago I asked if I can assume the memory held by dynamic arrays is
allocated in one contiguous block.

The answer was sth. like "No, never!".

I wrote a small testing programm using SetLenght() on an array multiple
times using a bigger size every time and comparing the addresses of the
allocated elements.

I wasn't able to provoke getting something else than sizeof(integer),
which is the base type of that array.

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

TIA,
Marc





More information about the fpc-pascal mailing list