Weak references and destructors

Mark S. Miller erights at google.com
Sat Dec 12 15:14:40 PST 2009


On Sat, Dec 12, 2009 at 3:07 PM, P T Withington <ptw at pobox.com> wrote:

> On 2009-12-11, at 12:43, Brendan Eich wrote:
>
> > It would be more than nice. It is important that the spec not mandate any
> particular schedule. We have seen endless over-coupling to GC implementation
> details where programmers who can hook into finalization or another GC phase
> do so for all the wrong reasons: to close fds, free database cursors, send a
> message, update UI, etc. Crazy stuff.
>
> +n
>
> In my experience, it is always a bad idea for the GC to invoke user-code.
>
>
Always? E uses async post mortem finalization to implement distributed
acyclic GC. Without some way for "GC to invoke user code", I don't see how
this is possible. Without it, the resulting memory leak is severe enough to
discourage many good distributed programming patterns.



> Please don't throw out the weak-key tables with the finalization bathwater.
>
> > But if there is no guarantee of when the notification might happen, then
> programmers should not expect any scheduling akin to setTimeout with a
> timeout of zero.
>
> I initially mis-read this as saying setTimeout with a timeout of 0 might
> never be scheduled.  But that's not what you said.
>
> --
>
> I was amused by this aside from the strawman:
>
> > Since I can never remember the black/white polarity of traditional gc
> descriptions, I will use retained for black, fringe for gray, and untraced
> for white.
>



-- 
   Cheers,
   --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20091212/b2adc9bf/attachment.html>


More information about the es-discuss mailing list