GDC - program runs in one thread, DMD - in 4 threads, why?
bauss
jj_1337 at live.dk
Fri Sep 10 11:09:10 UTC 2021
On Friday, 10 September 2021 at 10:39:48 UTC, Basile B. wrote:
> On Friday, 10 September 2021 at 09:27:49 UTC, eugene wrote:
>> Here is test program (which is using DList aggressively)
>> [...]
>> Can this (really unwanted) behavior be disabled in DMD?
>> I do not want to have multiple threads,
>> a program (real program, not the test above) has to be
>> single-threaded.
>>
>> system used:
>> @dexp ~ $ cat /etc/debian_version
>> 8.11
>
> most recent dmd has a GC that collect in threads. it can be
> tuned but I dont find the documentation for this right now.
Here's the specific change:
https://dlang.org/changelog/2.087.0.html#gc_parallel
```
GC now marks the heap with multiple threads
The garbage collector now uses available CPU cores to mark the
heap faster. This reduces pause times for a collection
considerably.
By default, the GC uses all available logical cores of your CPU.
This might affect your application if it has threads that are not
suspended during the mark phase of the collection. You can
configure the number of additional threads used for marking by
DRT option parallel to the GC configuration, e.g. by passing
--DRT-gcopt=parallel:2 on the command line. A value of 0 disables
parallel marking completely.
As usual, you can also embed the configuration into the
application by redefining rt_options, e.g.
extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ];
```
______________
So for OP what you want to use is:
```d
--DRT-gcopt=parallel:0
```
More information about the Digitalmars-d-learn
mailing list