[fpc-pascal] two questions about dynamic array

Sven Barth pascaldragon at googlemail.com
Wed Mar 13 14:22:29 CET 2013


Am 13.03.2013 10:53 schrieb "Xiangrong Fang" <xrfang at gmail.com>:
>
> 2013/3/13 Sven Barth <pascaldragon at googlemail.com>
>>
>> Am 13.03.2013 10:08 schrieb "Xiangrong Fang" <xrfang at gmail.com>:
>> > 2) After SetLength(myarray, 0), is myarray nil or pointing to some
invalid address?
>>
>> It will be Nil. An equivalent alternative would be:
>>
>> MyArray := Nil;
>
>
> Sorry, I didn't see this reply just now...   You mean, by MyArray := nil;
but NOT calling SetLength(MyArray, 0); there will NOT be memory leaks?

As dynamic arrays are reference counted they are equal.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130313/08cbdc3f/attachment.html>


More information about the fpc-pascal mailing list