[fpc-pascal] performance when resizing a dynamic array

Martin Schreiber mse00000 at gmail.com
Sun Dec 4 11:39:26 CET 2016

On 12/04/2016 11:28 AM, Graeme Geldenhuys wrote:
> Hi,
> If I use an array to hold a list of say Integers. Is there any serious
> performance penalty for resizing (growing) the dynamic array as I add
> items. My point being, I don't know the number of elements I'll need
> beforehand.
The problem with enlarging big dynamic arrays is that AFAIK there always
is a move operation of the whole existing data. Libc realloc() on the
other hand only relocates the pointer of a virtual memory block if possible.


More information about the fpc-pascal mailing list