Running out of memory ctfe 16GB

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 6 13:59:08 PDT 2017


On Thursday, 6 April 2017 at 20:49:00 UTC, Nierjerson wrote:
> I am running out of memory trying to generate CTFE code. It is 
> quite large generation but just repetitive loop acting on an 
> array item.

CTFE is a memory hog, and there's not much you can do about it. A 
new CTFE engine is in the works, and it's "coming soon".

I can tell you that if the array is actually an AliasSeq or a 
compiler tuple then what the compiler is doing is generating a 
new chunk of code for every loop iteration and then interpreting 
that, leading to O(n) memory used for the loop. Also, try to 
reduce your template instantiations as much as possible.



More information about the Digitalmars-d mailing list