On Thu, 13 Apr 2017 19:15:13 +0700 Ryan Joseph <[email protected]> wrote:
> > On Apr 13, 2017, at 7:08 PM, Mattias Gaertner <[email protected]> > > wrote: > > > >> 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. > > > > Correct. > > Why is it copying the array and freeing instead of resizing the existing > block (realloc)? That sounds crazy but I don’t know how memory managers work. It does not free the elements. It frees the array. Mattias _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
