Re: [dub] Passing --DRT-gcopt to dmd

2020-02-03 Thread Mathias Lang via Digitalmars-d-learn

On Friday, 31 May 2019 at 15:41:24 UTC, Anonymouse wrote:

On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote:

On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:

$ grep dflags dub.json
"dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ],


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.


Is this something I can/should report? (Where do dub issues go?)


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.


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn

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_cleanup


I 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.


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn

On Friday, 31 May 2019 at 15:31:13 UTC, kinke wrote:

On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:

$ grep dflags dub.json
"dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ],


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.


Is this something I can/should report? (Where do dub issues go?)


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread kinke via Digitalmars-d-learn

On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote:

$ grep dflags dub.json
"dflags": [ "-lowmem", "--DRT-gcopt=profile:1" ],


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.


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Andre Pany via Digitalmars-d-learn

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:

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"


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?


You can specify the parameters also in code. See example here

https://dlang.org/changelog/2.085.0.html#gc_cleanup

Kind regards
Andre


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Andre Pany via Digitalmars-d-learn

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:


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


This might be eaten by the runtime of dub and not the application.

Kind regards
Andre


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Anonymouse via Digitalmars-d-learn

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:


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"


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?


Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Mike Parker via Digitalmars-d-learn

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