Syntax for heap allocated void initialized arrays

Timothee Cour thelastmammoth at gmail.com
Tue Oct 15 21:05:08 PDT 2013


On Sat, Sep 21, 2013 at 7:23 AM, bearophile <bearophileHUGS at lycos.com>wrote:

> simendsjo:
>
>
>  I'm setting every element in the array, and every field of the
>> element, so I should be safe, right?
>>
>
> 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.
>
>
just to clarify:
is the following true?

int*[N] a=void;
foreach(i;N)
  a[i]=fillValue(i);// some leaks may occur during foreach loop
//at the next GC run, no more leaks due to that piece of code





> Bye,
> bearophile
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20131015/03fb3bd2/attachment.html>


More information about the Digitalmars-d-learn mailing list