digitalmars.D.learn - [dub] Passing --DRT-gcopt to dmd
- Anonymouse (13/37) May 31 2019 Doesn't work, doesn't give any extra output. Entering bogus flags
- Mike Parker (12/13) May 31 2019 --DRT flags are for run time, not compile time. They're intended
- Anonymouse (8/15) May 31 2019 My use-case is limiting the amount of memory dmd will allocate
- Andre Pany (5/23) May 31 2019 You can specify the parameters also in code. See example here
- Anonymouse (4/6) May 31 2019 I need it to apply to dmd though, I'm exceeding memory limits
- Andre Pany (4/17) May 31 2019 This might be eaten by the runtime of dub and not the application.
- kinke (5/7) May 31 2019 This should work indeed. I guess it doesn't because dub probably
- Anonymouse (2/9) May 31 2019 Is this something I can/should report? (Where do dub issues go?)
- Mathias Lang (12/22) Feb 03 2020 Replying here despite the delay because this is one of the top
I'm trying to tweak the GC when compiling with dub, starting with something easy like profile:1.$ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ], $ dub testDoesn't work, doesn't give any extra output. Entering bogus flags like --DRT-gcopt=banana:1 doesn't evoke any error message either, making me doubt it's being passed on at all.$ dmd -oftest -lowmem --DRT-gcopt=profile:1 source/**/*.d Number of collections: 13 Total GC prep time: 7 milliseconds Total mark time: 2110 milliseconds Total sweep time: 270 milliseconds Total page recovery time: 204 milliseconds Max Pause Time: 472 milliseconds Grand total GC time: 2592 milliseconds GC summary: 1099 MB, 13 GC 2592 ms, Pauses 2117 ms < 472 msManual dmd invocation does work, so it's not like dmd is ignoring --DRT-gcopt.$ dub test --DRT-gcopt=profile:1 [...] Number of collections: 10 Total GC prep time: 0 milliseconds Total mark time: 4 milliseconds Total sweep time: 7 milliseconds Total page recovery time: 4 milliseconds Max Pause Time: 0 milliseconds Grand total GC time: 15 milliseconds GC summary: 12 MB, 10 GC 15 ms, Pauses 4 ms < 0 msThe totals should be in the ballpark of 1Gb+ (as above), not 12Mb. Is it only profiling dub itself? (Incidentally this is roughly what dmd reports if called without -lowmem.)$ export DRT_GCOPT=profile:1 $ dub testDoesn't work either, I can't actually get the env var to affect dmd at all, even when manually running it. What is the correct way?
May 31 2019
On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:What is the correct way?--DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By default, GC options can only be passed on the command line of the program to run" With dub, anything following a solitary -- on the command line will be passed to the application [2], so you probably want something like this: dub test -- --DRT-gcopt=profile:1 [1] https://dlang.org/spec/garbage.html#gc_config [2] https://dub.pm/commandline
May 31 2019
On Friday, 31 May 2019 at 10:47:20 UTC, Mike Parker wrote:On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:My use-case is limiting the amount of memory dmd will allocate before -lowmem kicks in and collects (by use of --DRT-gcopt=heapSizeFactor on dmd), to accomodate for limited available memory. As pasted in the original post I seem to be able to do this manually. So there is no way to set up a dub build configuration that automates this?What is the correct way?--DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By default, GC options can only be passed on the command line of the program to run"
May 31 2019
On Friday, 31 May 2019 at 13:37:05 UTC, Anonymouse wrote:On Friday, 31 May 2019 at 10:47:20 UTC, Mike Parker wrote:You can specify the parameters also in code. See example here https://dlang.org/changelog/2.085.0.html#gc_cleanup Kind regards AndreOn Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:My use-case is limiting the amount of memory dmd will allocate before -lowmem kicks in and collects (by use of --DRT-gcopt=heapSizeFactor on dmd), to accomodate for limited available memory. As pasted in the original post I seem to be able to do this manually. So there is no way to set up a dub build configuration that automates this?What is the correct way?--DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By default, GC options can only be passed on the command line of the program to run"
May 31 2019
On Friday, 31 May 2019 at 13:50:57 UTC, Andre Pany wrote:You can specify the parameters also in code. See example here https://dlang.org/changelog/2.085.0.html#gc_cleanupI need it to apply to dmd though, I'm exceeding memory limits when compiling. Once done the program doesn't need a whole lot of it, but dmd -lowmem does.
May 31 2019
On Friday, 31 May 2019 at 10:47:20 UTC, Mike Parker wrote:On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:This might be eaten by the runtime of dub and not the application. Kind regards AndreWhat is the correct way?--DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By default, GC options can only be passed on the command line of the program to run" With dub, anything following a solitary -- on the command line will be passed to the application [2], so you probably want something like this: dub test -- --DRT-gcopt=profile:1 [1] https://dlang.org/spec/garbage.html#gc_config [2] https://dub.pm/commandline
May 31 2019
On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:This should work indeed. I guess it doesn't because dub probably uses a response file containing all cmdline options, whereas -lowmem definitely [and --DRT-* probably] need to be direct cmdline args.$ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ],
May 31 2019
On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote:On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:Is this something I can/should report? (Where do dub issues go?)This should work indeed. I guess it doesn't because dub probably uses a response file containing all cmdline options, whereas -lowmem definitely [and --DRT-* probably] need to be direct cmdline args.$ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ],
May 31 2019
On Friday, 31 May 2019 at 15:41:24 UTC, Anonymouse wrote:On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote:Replying here despite the delay because this is one of the top post when one google for gcopts. This will be possible with the new version of the runtime (>=2.091.0, not released yet). It has been filled as https://issues.dlang.org/show_bug.cgi?id=20459 and was fixed in https://github.com/dlang/druntime/pull/2881 which means dub compiled with druntime >= 2.091 will allow you to do: `dub -- --DRT-gcopt=profile:1` And any other D program will ignore `--DRT` options if provided after the `--` delimiter.On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:Is this something I can/should report? (Where do dub issues go?)This should work indeed. I guess it doesn't because dub probably uses a response file containing all cmdline options, whereas -lowmem definitely [and --DRT-* probably] need to be direct cmdline args.$ grep dflags dub.json "dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ],
Feb 03 2020