Dan Sugalski <[EMAIL PROTECTED]> writes:

> At 05:55 PM 12/7/00 +0000, Piers Cawley wrote:
> >Dan Sugalski <[EMAIL PROTECTED]> writes:
> > > I think I'd just as soon always call DESTROY in a predicable manner
> > > and not do *anything* perlish at GC time. If nothing else it means
> > > that we don't have to worry about having a valid perl context handy
> > > when the GC runs. (Since threading the thing is a possibility we
> > > might run into issues otherwise)
> >
> >So objects that get caught up in a circular reference chain don't get
> >their DESTROYs called? I'm not sure I'd be up for that. In fact, I'm
> >sure I *wouldn't* be up for that. Or are we gonna still need 'use
> >WeakRef'?
> 
> The problem there is that there's no good deterministic way to catch that short
> of doing a full mark and sweep (or something similar) each time we toss a pad
> that's got references in it. I suppose we could track pad references and
> variable references separately and do a quick walk through things when we trash
> a referring variable or pad, but I can see that getting expensive. Maybe. (On
> the other hand, if it's correct...)

I wasn't arguing for doing a full mark & sweep at every block end. I
was saying that we may still need to call DESTROY at mark & sweep time
even if most DESTROYable objects get DESTROYed in a simple refcount
phase at block end. (Having noted that we only need to do that kind of
thing for blessed refs).

This would tend to imply that we should keep WeakRefs lying around so
that concientious programmers with circular data structures that they
want to be DESTROYed immediately can arrange things so that can
happen. 

-- 
Piers

Reply via email to