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 GC0 ms, Pauses0 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?