<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Jul 31, 2018 at 11:39 AM Santiago A. <<a href="mailto:svaa@ciberpiula.net">svaa@ciberpiula.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm not very sure how open arrays are copied<br></blockquote><div>In your example you don't have open arrays used - you have dynamic arrays.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I looks like working fine. MyArray.ArrayInt[0] is still 5. But I wonder <br>
whether it is really right or just luck. Open arrays are pointers, so, <br>
when tmpList gets out of scope then tmpList.arrayInt is freed. </blockquote><div><br></div><div>The compiler is aware of managed (reference counted) type fields within a dynamic array body.</div><div>Thus each ArrayInt in "aList" would have reference count increased.<br></div><div>Thus when tmpList is released ArrayInt stays, as its reference count doesn't reach zero.</div><div><br></div><div>thanks,</div><div>Dmitry</div></div></div>