chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How should we deal with weak refs to finalizable objects? (was: Re: [PA


From: felix . winkelmann
Subject: How should we deal with weak refs to finalizable objects? (was: Re: [PATCH] Bugfix and drop weak references to finalizable objects (was: Re: [PATCH] thread-safe handling of asynchronous events))
Date: Mon, 10 Jul 2023 11:13:40 +0200

> However, there's one more concern:
>
> > The potential use-after-free scenario can still happen if the object is
> > kept alive, regardless of how we handle weak refs, this is unavoidable
> > if we allow finalizers and keep the possibility of resurrection.
>
> I have thought about this a bit more but I came to the conclusion that
> from an abstraction point of view it's better to clear weak refs to
> finalized data.  The reason is that when a module exposes an object, the
> *user* should not need to know or care exactly how that object is
> implemented and that it happens to use a finalizer.
>

I concur - it indeed breaks the abstraction. IHMO both behaviours (clearing
weak refs or not) have potential to confuse the user, but merely adding a
finalizer should not semantically change the behaviour of weak refs.
Let me think a bit more about this, please.


felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]