[fpc-pascal] Array clearing
g.marcou at unistra.fr
Thu Apr 13 13:17:37 CEST 2017
Regarding this code:
> Array[High(Array)] := …
as I understood from (http://wiki.freepascal.org/Dynamic_array <http://wiki.freepascal.org/Dynamic_array>), SetLength will create a copy of the array and free the memory of the shorter array. In this case, a lot of memory operations and copy operations are performed thus degrading the performances of the code. Then it would be unwise to use such strategy: better allocate the size of the array correctly at the beginning of the run, or resize the array by block, to decrease the frequency of such operation:
Can somebody confirm (or invalidate) this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal