On 09/09/2011 10:30 PM, Timon Gehr wrote:
void main(){
mixin({
string r;
foreach(i;0..12000) r~=q{mixin(q{{enum x="";}});};
return r;
}());
}

When I compile this program, DMD sometimes uses about 1GB of memory,
sometimes about 2GB of memory and sometimes it makes my OS crash.

Can anyone reproduce this?

Similarly this:

template TT(string s){enum TT=s;}

void main(){
    mixin({
            string r;
            foreach(i;0..12000) r~=q{{enum x=TT!"";};};
            return r;
        }());
}

That does use a somewhat smaller amount of memory, but it is still huge and non-deterministic in size.

Reply via email to