[fpc-pascal] Arrays of objects
Marco van de Voort
marcov at stack.nl
Wed Oct 31 13:30:00 CET 2007
> On 10/31/07, Joao Morais <post at joaomorais.com.br> wrote:
> > They are reference counted, just like ansi strings, ie don't worry about
> > memory leakages.
>
> The detail that is not crystal clear to me is : after the first SetLength
> and i set the first 3 elements , is it *guaranteed* that the
> second SetLength
> leaves those first 3 elements untouched ?
Yes. But they can be copied, so address to them might be invalid.
> That's what i meant by "resize" as opposed to "reallocate" . Reallocation
> could occur in some other place in memory , leading to loosing the
> original contents.
It does resize if possible, reallocate (and copy the original data as far as
it fits) else.
More information about the fpc-pascal
mailing list