https://issues.dlang.org/show_bug.cgi?id=19947

--- Comment #7 from Rainer Schuetze <[email protected]> ---
> How does this square with the fact that calling GC.collect()
> inside the for loop also makes the program run to completion?

When running GC.collect() after the allocation, you are changing the amount of
memory that the GC overallocates before running the next collection (2 times
the live memory at the time of the previous collection). This changes the
probability of getting false pointers.

> Also, the array is initialized with 0, so any false false pointers
> would be invisible to the user code.

The content of the int[] array is not scanned, the false pointers in the data
segment (and the stack, -gx might help) are the issue here. These can pin the
large allocations. Address randomization (ASLR) makes it rather unpredictable,
too.

--

Reply via email to