* Joe Schaefer <[EMAIL PROTECTED]> [2002-07-09 12:47]:
> Dave Rolsky <[EMAIL PROTECTED]> writes:
> > On 8 Jul 2002, Joe Schaefer wrote:
> > If I do this:
> > 
> >  my $x = shift;
> >  $x = make_something_from($x);
> > 
> > then it seems like the original $x should go out of scope when it is
> > assigned to, so its refcount should stay at 1.
>                                ^^^^^^
> 
> Right, it should stay at 1.  But all bets are off when
> $x is has magic and make_something_from() is an XS sub :-).

But the leak is not with $x, it's with what $_[0] is; $x is just a
reference to that, and the reassignment in the second line should
reassign $x, and decrement the ref count for what $x is pointing to at
that point.  So, it all depends on what make_something_from() does with
the $x's referent.

(darren)

-- 
Great minds discuss ideas.
Average minds discuss events.
Small minds discuss people.
    -- Admiral Hyman G. Rickover

Reply via email to