develooper Front page | perl.perl6.language | Postings from February 2001

Re: Garbage collection (was Re: JWZ on s/Java/Perl/)

Dan Sugalski
February 12, 2001 13:29
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
At 09:08 PM 2/12/2001 +0000, Piers Cawley wrote:
>Dan Sugalski <> writes:
> > At 10:38 AM 2/12/2001 -0500, Sam Tregar wrote:
> > >On Mon, 12 Feb 2001, Dan Sugalski wrote:
> > >
> > > > Perl needs some level of tracking for objects with finalization 
> attached to
> > > > them. Full refcounting isn't required, however.
> > >
> > >I think I've heard you state that before.  Can you be more specific?  What
> > >alternate system do you have in mind?  Is this just wishful thinking?
> >
> > This isn't just wishful thinking, no.
> >
> > > > Also, the vast majority of perl variables have no finalization
> > > > attached to them.
> > >
> > >That's true, but without static typing don't you have to treat them as if
> > >they did?  At the very least you need to do a "is it an object with a
> > >DESTROY" check at block boundaries.
> >
> > Code flow analysis can get an awful lot. Some help from the runtime
> > will get the rest.
> >
> >
> > It's reasonably obvious (which is to say "cheap") which variables
> > aren't involved with anything finalizable.
>Remember too that right now we don't properly finalize everything as
>quickly as we should in the cases where stuff is caught up in circular
>references. We don't need to be perfect, but we do need to be

Yep, that's another issue, and one I keep forgetting about, though the fact 
that we don't do predictable finalization on some objects isn't a good 
reason to not do it for any of them. I really don't want to guarantee 
predictable end-of-block cleanup, though, since that means a potentially 
expensive GC run more often than we might otherwise do.

One more thing for the GC PDD, I think.


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                      teddy bears get drunk Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About