dub and -lowmem: does nothing

Anonymouse zorael at gmail.com
Fri Mar 20 23:37:52 UTC 2020


Manjaro/Arch x86_64, dmd v2.091.0, dub 1.19.0.

I have a project which dmd on Windows fails to compile, throwing 
an OutOfMemoryError[1]. Up until recently it could be worked 
around by using `--build-mode=singleFile`, but now that's no 
longer enough and errors out too (on AppVeyor).

The obvious solution is to set `-lowmem` in dub.sdl, but it seems 
to do nothing, as measured *in Linux* by the amount of memory 
used with zsh's `time` shell built-in.

If using zsh time, you may need the following environmental 
variable to get the required output:

```
TIMEFMT='%J   %U  user %S system %P cpu %*E total
avg shared (code):         %X KB
avg unshared (data/stack): %D KB
total (sum):               %K KB
max memory:                %M MB
page faults from disk:     %F
other page faults:         %R'
```

A gutted test branch: (has two dependencies)
> git clone https://github.com/zorael/tests.git -b lowmem

1. `dub build` on a default configuration without -lowmem defined 
shows some ~2011 Mb used.
2. If I run dub with -v, then copy the dmd command it runs and 
execute it manually, I get the same ~2012 Mb used. Close enough, 
makes sense.
3. `dub build -c lowmem` for an identical configuration but with 
dflags "-lowmem" added, nothing changes and I still get ~2011 Mb 
used.
4. If I run dub with -v on the lowmem configuration and 
copy/paste *the same command it ran*, unmodified, I suddenly get 
the more expected ~1183 Mb used.

Log: https://pastebin.com/raw/yDnCj1KJ

-lowmem is visibly present in the dmd command listed with -v, but 
it seems to do nothing through dub.

How? Why?


> dub remove lu --version="*"
> dub remove dialect --version="*"

[1]: https://issues.dlang.org/show_bug.cgi?id=20562


More information about the Digitalmars-d-learn mailing list