On 25/10/2020 11:03 PM, Ali Çehreli wrote:
Does the GC see that local variable 'name' that is on the C side? What I don't know is whether the GC is aware only of the stack frames of D functions or the entire thread, which would include the C caller's 'name'.

The thread stack frame that is registered with the D GC will know about the D side and may know about the C side.

It depends on what the C side is doing.

If the C side went ahead and made a new stack frame via a fiber... it won't know about it. But even if it did, the D stack frame is still alive and pinning that bit of memory.

Ultimately, if the C side puts that pointer some place like a global or send it to another thread, there are no guarantees that things will play out well.

Reply via email to