What should happen here?

jfondren julian.fondren at gmail.com
Wed Sep 22 20:31:51 UTC 2021


On Wednesday, 22 September 2021 at 19:50:37 UTC, IGotD- wrote:
> The problems described in this thread are really fringe 
> problems and I think it could be resolved by other means. 
> KeepAlive is one of them and it is also a GC agnostic, works on 
> any GC. I rather say b is the better alternative, covering for 
> those very special cases.


If GC.keepAlive is added, how do you know when to use it without 
first running into this fringe problem in a specific part of your 
code? In the code that prompted this discussion, the object 
lifetimes immediately around the C API calls were actually fine. 
GC.keepAlive in the functions with those API calls, even if 
applied to the exact object whose lifetime was too short, would 
not have saved the object.


More information about the Digitalmars-d mailing list