As far as I know Delphi always allocates a generous space for dynamic arrays to avoid relocation when the dynamic array's size is increased (using SetLenghth()
, e.g.)
However, in many cases just a single SetLength
will occur, when creating the class, so once the array has got dimensioned it can be considered henceforth a “constant-length” one. That is, there is absolutely no need to allocate a bigger-then-necessary space to the array.
So, is there a directive, a trick etc. for telling Delphi that the array in question is actually a “fake constant length” array, that is, its length should be set in a conservative way?