toStringz lifetime

rikki cattermole rikki at cattermole.co.nz
Mon Nov 9 02:58:41 UTC 2020


On 09/11/2020 2:58 PM, Ali Çehreli wrote:
> Does the D GC know the complete function call stack of the C program all 
> the way up from 'main'? Is there the concept of "bottom of the stack" or 
> does the D GC can only know the value of the stack pointer at the time 
> rt_init() was called. If the latter, then I think a toStringz string may 
> not be alive in a C function.

https://github.com/dlang/druntime/blob/master/src/core/thread/context.d#L16
https://github.com/dlang/druntime/blob/master/src/core/thread/threadbase.d#L469
https://github.com/dlang/druntime/blob/master/src/core/thread/osthread.d#L1455
https://github.com/dlang/druntime/blob/master/src/core/thread/osthread.d#L1208

I'm tired, so here is the code related to your questions.

Note: the GC will use this abstraction for dealing with stack frames 
(otherwise it would be duplicated).


More information about the Digitalmars-d-learn mailing list