Compilation is taking a ton of memory

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Wed Jul 4 20:17:22 UTC 2018


On 06/27/2018 12:00 PM, Mario Silva wrote:
> Hello,
> 
> Our code base has been growing steadily and it's currently at a point 
> where my 16GB machine just freezes when we're compiling our code. This 
> happens because DMD just consumes all my memory for a while.
> 
> Also, it's taking a long time to compile it. Less than an year ago our 
> project was taking around 17 seconds to compile - no libs requiring 
> compilation - and maybe around 50 seconds for full compilation, and it 
> now takes around 50 seconds for an incremental compilations and around 
> 1.5 minutes for a full one.
> 

Memory consumption is a known issue with the D frontend implementation. 
As others have said, CTFE never freeing memory is considered to be a big 
part of the issue here. The CTFE rewrite someone is doing should help 
with that when it's done.

Long compilation times are almost always the fault of Dub. Dub is pretty 
well-known for taking DMD's near-instant compile times and bloating them 
out to the ridiculous (by D standards) lengths you're experiencing. I'd 
say try just writing a basic buildscript that runs DMD directly. Plus, 
that way you can customize it to your own project's needs: Which 
files/packages get compiled together, which get compiled separately.


More information about the Digitalmars-d mailing list