Did really think about that:)
But off the top of my head...
This is only a guess, but
my $a;
$a = \$a;
A match of two addresses. Though we are assigning on reference to a scalar,
we can match both addresses?
package CircRef;
sub new {
my $self = [];
bless $self, shift;
$self->[0] = $self; # <-- circular reference.
return $self;
}
The match of both object would genereate a circular reference.
I guess by doing some extra checking this can be accomplished, just don't
know if 100%, since can't think of other scenerious right now and the above
suggestion might be wrong too:)
But as Dan said, GC will take care of that. I know that I've read somewhere
before that Python keeps track of it's circular references, so I was sure
there was a way of doing this, just not exactly sure how it was implemented.
Ilya
-----Original Message-----
From: Buddha Buck
To: Sterin, Ilya; '[EMAIL PROTECTED]'
Sent: 08/01/2001 1:18 PM
Subject: Re: Circular references
At 01:01 PM 08-01-2001 -0600, Sterin, Ilya wrote:
>I was just wondering if there will be any solution for the circular
>refernece memory leak (I guess you can call it a problem). Can't we
keep
>information on the number of circular references in the SV structure
and
>then decrement the references count by one + the circular reference
count at
>the end of scope?
Dan has already answered (dead-object detection sweeps by the GC will
take
care of it), but I'm curious?
How do you detect a circular reference so you can update the circular
reference count?
>Ilya