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

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

Thread Previous | Thread Next
February 12, 2001 07:44
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
Jan Dubois wrote:
> On Mon, 12 Feb 2001 01:44:54 -0500, Dan Sugalski <> wrote:
> >Perl needs some level of tracking for objects with finalization attached
> >them. Full refcounting isn't required, however. Also, the vast majority
> >perl variables have no finalization attached to them.
> That's all fine and dandy, but it will be even slower than the current
> refcounting scheme (in addition to inc/dec'ing the refcount you *also*
> need to check if the current entity is being refcounted).  I'm not saying
> that this is necessarily a bad space/time tradeoff.  But many people seem
> to think that using mark-and-sweep for garbage collection will be a
> performance boost.  This may not be the case if objects still need to
> reference counted.
> >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.
> [snip]
> Of course you can combine both schemes to decouple destruction from GC,
> but you then have to pay the price of both systems.  If you know of a way
> around this, please share!

I think having both copying-GC and refcounting-GC is a good idea. I may be
saying a stupid thing, since I'm not a GC expert, but I think objects that
rely on having their destructors called the soonest possible for resource
cleanup could use a refcount-GC, while other objects that don't need that
could use a copy-GC. I really don't know if this is really feasible, it's
only an idea now. I also note that objects that are associated to resources
aren't typically the ones that get shared much in Perl, so using refcount
for them wouldn't be very expensive...

Am I too wrong here?

- Branden

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About