Fiber implementation questions

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 21 08:43:31 PDT 2016


On Tuesday, 21 June 2016 at 12:18:37 UTC, Steven Schveighoffer 
wrote:
> On 6/21/16 6:14 AM, Dicebot wrote:
>> On 06/20/2016 11:17 PM, deadalnix wrote:
>>>> Q2: core.thread.Fiber implementation looks like GC does not 
>>>> scan
>>>> function stacks for yielded contexts. Why?
>>>>
>>>
>>> Doesn't it ?
>>
>> https://github.com/dlang/druntime/blob/master/src/core/thread.d#L4328
>> allocates fiber stack using mmap / malloc / VirtualAlloc and 
>> doesn't
>> seem to register that memory in GC. But that may be indirect 
>> result of
>> https://github.com/dlang/druntime/blob/master/src/core/thread.d#L4439
>> call, which is why I am not sure.
>
> It appears that Fibers interact with the GC differently:
>
> https://github.com/dlang/druntime/blob/master/src/core/thread.d#L1611
>
> -Steve

I suspected something like this, it explains a lot. Do you know 
why this approach was chosen instead of simply registering 
allocated memory for GC scan? Does GC has special approach for 
stack scanning which differs from normal memory?


More information about the Digitalmars-d mailing list