toStringz lifetime

Johan Engelen j at j.nl
Sun Oct 25 11:59:23 UTC 2020


On Sunday, 25 October 2020 at 10:03:44 UTC, Ali Çehreli wrote:
>
> Is it really safe? Imagine a multi-threaded environment where 
> another D function is executed that triggers a GC collection 
> right before the printf.
>
> 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'.

Small note: besides the stack, it is crucial that the GC is aware 
of the CPU register values.

-Johan



More information about the Digitalmars-d-learn mailing list