Compilation with dub + dmd: out of memory
Mathias LANG via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 10 03:41:06 PST 2015
On Tuesday, 10 February 2015 at 11:24:21 UTC, Vlasov Roman wrote:
> I have the quite computer with 2 GB RAM. At compilation with
> dub and dmd of small project this pair eating about 1.4~1.5 GB
> RAM. I solve this probleb by connecting swap partition, but it
> calls some freezes + it take ~10% of swap, and after
> compilation swap not released. At switching off swap as result
> we get ~200 MB of "dead data" in RAM, which can be released by
> rebooting. How i can resolve it?
First, if the program terminated, there is no dead data. Some
might be shown as used with utilities as top, but running 'free'
will probably show that your data is still "buffered", but
available for other programs to use.
You can run this command to see the effect of dropping cache:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free
Back to dub... DMD way of managing memory is fast, at the expense
of memory. I could not really enjoy fast compile time on my 4 GB
machine either, everything changed when I switched to 8 GB.
There is an option in dub to compile every object file
separately, it's '--build-mode=singleFile'. However, it has no
tracking of updated files (as make as), so it rebuild everything,
everytime. It makes the whole process slower, but you can use it
if you run out of memory (I compiled Vibe.d on a 512 MB machine
few months ago).
More information about the Digitalmars-d-learn
mailing list