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

Understanding refcounts

Thread Next
Simon Wistow
May 5, 2008 14:53
Understanding refcounts
Message ID:
I've been looking at Devel::Gladiator

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;


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 


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About