More fun with toStringz and the GC

jfondren julian.fondren at gmail.com
Fri Aug 5 23:13:41 UTC 2022


On Friday, 5 August 2022 at 22:51:07 UTC, Don Allen wrote:
> My theory: because gc_protect2 is never referenced, I'm 
> guessing that the compiler is optimizing away the storage of 
> the returned pointer, the supporting evidence being what I said 
> in the previous paragraph. Anyone have a better idea?

A local variable definitely isn't enough: 
https://forum.dlang.org/thread/xchnfzvpmxgytqprbosz@forum.dlang.org

This package came of it: https://code.dlang.org/packages/keepalive



More information about the Digitalmars-d-announce mailing list