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

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

Thread Previous | Thread Next
From:
Uri Guttman
Date:
February 16, 2001 06:46
Subject:
Re: Garbage collection (was Re: JWZ on s/Java/Perl/)
Message ID:
200102161445.JAA14468@home.sysarch.com.
>>>>> "TB" == Tim Bunce <Tim.Bunce@ig.co.uk> writes:

  TB> On Thu, Feb 15, 2001 at 02:26:10PM -0500, Uri Guttman wrote:
  >> >>>>> "TB" == Tim Bunce <Tim.Bunce@ig.co.uk> writes:
  >> 
  TB> As a part of that the weak reference concept, bolted recently into
  TB> perl5, could be made more central in perl6.
  >> 
  TB> Around 92.769% of the time circular references are known to be
  TB> circular by the code that creates them (like a 'handy' ref back to
  TB> a parent node).  Having a weakref, or similar, operator in the
  TB> language would help greatly.
  >> 
  >> i second this. i am doing just what tim mentions. i have a child and
  >> parent object referring back to each other for callback purposes. the
  >> parent needs to own the child and the child has to have a parent ref to
  >> make a method callback in the parent. there is no way out of creating
  >> circular refs in that situation. i have to do an explicit object
  >> shutdown so i don't leak ram. this isn't a big problem in stem since you
  >> have to explicitly unregister stuff as well (that can't be done with
  >> scope exit) but it would still be nice not to have to worry about the
  >> ref loops.

  TB> So why not use the WeakRef module (or whatever it's called)?

as i said, i need an explicit shutdown for other reasons in most cases
(a global registry being one of them). and i have heard that weakref is
not perfect so i haven't explored it. as of the moment i have just
developed a circular link breaking style for these objects and it
works. 

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

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