[Dlang-study] [lifetime] Initial thoughts on lifetime management
Walter Bright
walter at digitalmars.com
Wed Oct 28 15:54:11 PDT 2015
On 10/28/2015 3:28 PM, Andrei Alexandrescu wrote:
> On 10/28/2015 04:01 PM, Walter Bright wrote:
>> Another option is, when doing an assignment to an rc handle, and the ref
>> count goes to zero, to not delete the rc object, but to hand it to the
>> garbage collector to eventually reap.
>
> Two matters:
>
> 1. Planning to let objects leak seems like a cop-out if we find ourselves in
> front of an insoluble problem. So it's at best an escape trap, but I'd very
> much suggest we don't rely on it throughout this discussion.
We've already talked about relying on the GC to pick up cyclic graphs. I do
understand the sentiment, yet I have never seen such a scheme proposed before.
As such, it also may inspire new ways of thinking about how to deal with this
problem.
>
> 2. This won't work with non-GC allocators - it'll just leak.
>
>
That's right.
More information about the Dlang-study
mailing list