<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 21, 2013 at 7:23 AM, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">simendsjo:<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I'm setting every element in the array, and every field of the<br>
element, so I should be safe, right?<br>
</blockquote>
<br></div>
I think that's sufficiently safe. If the GC run before you have initialized those fields, and some of those fields are references/pointers, that could cause memory leaks until the next time the GC runs.<br>
<br></blockquote><div><br></div><div>just to clarify:</div><div>is the following true?</div><div><br></div><div>int*[N] a=void;</div><div>foreach(i;N)</div><div>  a[i]=fillValue(i);// some leaks may occur during foreach loop</div>
<div>//at the next GC run, no more leaks due to that piece of code </div><div><br></div><div> <br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Bye,<br>
bearophile<br><br>
</blockquote></div></div></div>