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 10:29
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
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.

> > I do wish people would get garbage collection and finalization split in
> > their minds. They are two separate things which can, and will, be dealt
> > with separately.
>2x the penalty, right?  Instead of a speed increase we carry the burden of
>ref-counting in addition to the overhead of an alternate system.

Nowhere near double the penalty. We only need to deal with refcounts when 
references are actually taken, assigned, or destroyed. That's a rare 
occurrence, relatively speaking.


--------------------------------------"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