www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Tweakig -lowmem to be more eager

reply Anonymouse <asdf asdf.net> writes:
I have CircleCI set up to test my project when I push to GitHub.

For a free user there the memory restriction is pretty severe (4 
Gb), and as such non-trivial programs cannot be compiled without 
separate compilation.

This sounded like a clear-cut case for -lowmem, but the process 
is still killed from allocating too much.

circleci ab1d64fc40cf:~/project$ dub test
Running custom 'unittest' configuration.
Performing "unittest" build using /usr/bin/dmd for x86_64.
cachetools 0.1.2: building configuration "library"...
requests 1.0.8: building configuration "std"...
kameloso 1.1.3+commit.31.g11ba25fd: building configuration 
"unittest"...
Killed
/usr/bin/dmd failed with exit code 137.

dub test -v shows -lowmem being properly passed to dmd.

What makes it decide to collect? What triggers it?
May 19 2019
next sibling parent Anonymouse <asdf asdf.net> writes:
On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote:
 Tweakig
I'd edit the title if I could. Grumble mutter.
May 19 2019
prev sibling parent reply Boris-Barboris <ismailsiege gmail.com> writes:
On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote:
 What makes it decide to collect? What triggers it?
You can try setting heapSizeFactor option to something lower than 2 to increase collection frequency: https://github.com/dlang/druntime/blob/47b03c14a1097d28afcf22f645628ba4046377bd/src/core/gc/config.d#L26 https://dlang.org/spec/garbage.html#gc_config dmd appears to respect DRT_GCOPT environment variable. The logic behind the decision to collect, I'm afraid, is not described anywhere but the code itself (https://github.com/dlang/druntime/blob/47b03c14a1097d28afcf22f645628ba4046377bd/src/gc/impl/conservative/gc.d#L1690)
May 20 2019
parent Anonymouse <asdf asdf.net> writes:
On Monday, 20 May 2019 at 13:41:15 UTC, Boris-Barboris wrote:
 On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote:
 What makes it decide to collect? What triggers it?
You can try setting heapSizeFactor option to something lower than 2 to increase collection frequency: https://github.com/dlang/druntime/blob/47b03c14a1097d28afcf22f645628ba4046377bd/src/core/gc/config.d#L26 https://dlang.org/spec/garbage.html#gc_config dmd appears to respect DRT_GCOPT environment variable.
This does look like what I need. I'm having no luck with DRT_GCOPT though. $ dmd "--DRT-gcopt=heapSizeFactor=1.5 profile:1" hello.d Number of collections: 2 Total GC prep time: 0 milliseconds Total mark time: 0 milliseconds Total sweep time: 0 milliseconds Total page recovery time: 0 milliseconds Max Pause Time: 0 milliseconds Grand total GC time: 0 milliseconds GC summary: 5 MB, 2 GC 0 ms, Pauses 0 ms < 0 ms $ DRT_GCOPT="heapSizeFactor=1.5 profile:1" dmd hello.d [no output] Are you sure dmd honours it? I can't grep rt_envvars_enabled in the dmd sources. How can I otherwise get dub to pass these onto dmd?
May 21 2019