In conclusion, stack allocation must be destroyed

FeepingCreature feepingcreature at gmail.com
Mon Jul 18 12:13:47 UTC 2022


On Thursday, 14 July 2022 at 13:14:59 UTC, ryuukk_ wrote:
> It is misleading, nobody expect this to be GC allocated
>
> It should be equal to:
>
> ```D
> int[3] arr = [1, 2, 3]
> ```
>
> Also why it is GC allocated without requiring ``new``?

DMD 2.099 has introduced crippling bugs that arise from 
overzealous stack allocation. If I could have a command line 
switch that would always heap allocate everything not *completely 
obviously* a stack allocation, ie. always heap allocate closures, 
always heap allocate arrays, I would put it in our build scripts 
and never touch it again.

Stack allocation without extremely reliable escape analysis is an 
express ride to corruptiontown. And D does not have extremely 
reliable escape analysis.


More information about the Digitalmars-d mailing list