dmd out of memory compiling vibed project

H. S. Teoh hsteoh at quickfur.ath.cx
Wed May 22 16:23:30 UTC 2019


On Wed, May 22, 2019 at 12:49:56PM +0000, Guillaume via Digitalmars-d wrote:
> Hi,
> 
> I'm using dmd 2.086.0 and vibe.d 0.85.0 to compile a vibe.d project
> with ~20 views (*.dt). On my main computer, I have no problems but my
> laptop has only 4 gig of RAM and dmd is killed before the end of the
> compilation because it takes more than 4 gig of RAM.
> 
> I've tried the new -lowmem switch (in DFLAGS in dmd.conf) but it
> doesn't change anything. It does work with the "singleFile" option
> with dub but it's really long to compile... And the "singleFile"
> option seems to recompile everything even if I only change one ".d"
> source file.
[...]

Use separate compilation. (I don't know if dub support this.)

Also, in my own vibe.d project, I split up the Diet templates across
multiple modules, because they are extremely compile-time intensive. For
example, I had one set of pages dealing with account creation, another
set of pages with the main functionality, so I split them up into two
modules -- since it's unlikely I'll be changing both sets of pages at
the same time. That, plus separate compilation, cuts compile time by
half.  Better yet, I split up front-facing UI code (mainly Diet
templates) from backend logic, so that the Diet templates are not
recompiled while I'm changing only the backend logic.


T

-- 
Customer support: the art of getting your clients to pay for your own incompetence.


More information about the Digitalmars-d mailing list