Ref counting for CTFE?

Remo via Digitalmars-d digitalmars-d at puremagic.com
Thu May 29 14:20:47 PDT 2014


On Thursday, 29 May 2014 at 17:54:08 UTC, Timon Gehr wrote:
> On 05/29/2014 07:33 PM, Steven Schveighoffer wrote:
>>
>> But CTFE is full of code that expects to have a GC running, 
>> e.g. string
>> concatenation for mixins, etc.
>
> Even the following code runs out of memory on my machine:
>
> int foo(){
>     foreach(i;0..100000000){}
>     return 2;
> }
> pragma(msg, foo());
>
> I.e. incrementing the loop counter consumes memory.

Using x64 build of DMD this code will compile but consumes about 
9 GB of RAM.
So this is really not optimal.


More information about the Digitalmars-d mailing list