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

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

Thread Previous | Thread Next
From:
David Mitchell
Date:
February 14, 2001 02:54
Subject:
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
200102141054.KAA25856@tiree.fdgroup.co.uk
James Mastros <james@rtweb.net> wrote:
> The idea is [for Larry] to declare "no, it isn't".  Otherwise, you have to
> do refcounting (or somthing like it) for DESTROY to get called at the right
> time if the class (or any superclass) has an AUTOLOAD, which is expensive.

I'm coming in halfway through a thread, which is always dangerous, but...
the above seems to imply a discussion that you only need to do expensive
ref-counting (or whatever) on objects which have a DESTROY method.
However, since you dont know in advance what class(es), if any, a thinngy
will be blessed as, you always have to ref-count (or whatever technique is
chosen) just to be sure:

my $h = {}; $ref1 = \$h; $ref2= \$h; ...

# we havent been ref-counting because $h is isnt an object.

bless $h, some_class_with_a_destroy_method;

# whoops, $h now needs to be properly managed. Anyone remember
# what's pointed at it ???


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About