What should happen here?

deadalnix deadalnix at gmail.com
Mon Sep 27 22:15:26 UTC 2021


On Monday, 27 September 2021 at 13:59:57 UTC, Steven 
Schveighoffer wrote:
> What I'm saying is, *if* you need a specific address saved for 
> later in a function, wouldn't you prefer to store that on the 
> stack rather than store it in the GC's roots? This would 
> absolutely be opt-in, not automatic, as I don't see how we can 
> do it automatically.
>
> -Steve

Honestly, I don't see why storing the GC root needs to be 
expensive. If it is that is a problem. You could literally 
compare and swap a counter to get a slot in the buffer and then 
store the pointer there, and granted there is no contention, it's 
effectively free (and if you have contention on addRoot, I can 
tell you what i'm talking about here is the least of your 
concerns).


More information about the Digitalmars-d mailing list