D create many thread

Steven Schveighoffer schveiguy at gmail.com
Wed Feb 5 15:54:23 UTC 2020


On 2/5/20 8:05 AM, Eko Wahyudin wrote:
> Hi all,
> 
> I'm create a small (hallo world) application, with DMD.
> But my program create 7 annoying threads when create an empty class.
> 
> What is this thread for?
> and is it normal in D?

> Thank you in advance.

I didn't know about this feature. I was going to respond that it is not 
normal, but this was added almost a year ago.

First, I think this is a bit over the top. A hello world program should 
not spawn threads to aid in marking.

Looking at the PR that made this happen, I think the author originally 
had reservations about it: 
https://github.com/dlang/druntime/pull/2514#issuecomment-487090334

I think we should be more selective about when we make parallel threads 
to scan (maybe above a certain size of used memory?).

-Steve


More information about the Digitalmars-d-learn mailing list