develooper Front page | perl.perl5.porters | Postings from May 2008

Understanding refcounts

Thread Next
From:
Simon Wistow
Date:
May 5, 2008 14:53
Subject:
Understanding refcounts
Message ID:
20080505215300.GV93783@thegestalt.org
I've been looking at Devel::Gladiator

http://code.sixapart.com/svn/Devel-Gladiator/trunk/

and trying to work out why

  while (1) {
    my $array = Devel::Gladiator::walk_arena();
  }

leaks memory incredibly fast yet 

  while (1) {
    my $array = Devel::Gladiator::walk_arena();
    $array    = undef;
  }

doesn't.

It's careful to make sure that no SVs are created whilst it's walking 
the arenas but I can't quite work out why it doesn't get freed when it 
pops out of scope.

I presume there's a good and subtle reason why but lacking a good guide 
to the GC I'm just sort of taking that as an article of faith rather 
than understanding why. 

Does such a beast exist? Can someone offer enlightenment as to what's 
happening?

Simon



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