CTFE Memory Hogging Workaround?

Timon Gehr timon.gehr at gmx.ch
Thu Nov 22 17:04:44 PST 2012


On 11/22/2012 11:33 PM, Maxime Chevalier wrote:
> One of the reasons I chose to use D for my project is that I was very
> excited about the prospect of using CTFE in mixin code. Unfortunately,
> there seems to be one (or several?) bugs causing CTFE to be very slow
> and to hog a huge amount of memory (multiple gigs of RAM and swap). I
> use the latest dmd and my mixin code uses an Appender!string object to
> produce a long string of D code containing multiple functions (~1500
> lines).
>
> Is there some known fix for this? ...

Simple code generation should work fine, even given the current 
implementation quality. You need to determine what part causes it to be 
slow. Comment out some of the code and do measurements. Also try using 
plain strings instead of appender.

I cannot give any more support given the limited information.


More information about the Digitalmars-d-learn mailing list