[Catalyst-dev] Need help debugging Text::ASCIITable

Andy Grundman andy at hybridized.org
Mon Sep 26 17:41:40 CEST 2005

Perrin Harkins wrote:
> Andy Grundman wrote:
>> I've been trying to fix the leak in T::A but I'm totally stumped, and 
>> so is the author.  If anyone wants to take a crack at it, I've 
>> attached my test script.
> The way you're testing this looks a little suspect to me.  First, Perl 
> doesn't take more memory every time you use a new variable.  Memory is 
> allocated in chunks, so it's hard to predict when the next chunk will be 
> grabbed.
> Also, memory is not reclaimed from lexical variables when they go out of 
> scope.  Perl keeps that memory allocated to $x AFTER it goes out of 
> scope as an optimization.  You have to explicitly undef it to prevent 
> this.  Now, $x is just a single blessed reference here, but keep it in 
> mind.

Actually I still think it's a valid test, and so far the only way I can 
detect the memory leak.  Devel::Size doesn't seem to handle tied arrays, 
and Test::Memory::Cycle and Data::Structure::Util are no help either.

If you comment out the tie in new(), the test will pass.  If you bump up 
the iterations to 5000 or something, it will use even more memory than 
at 1000.  So I trust that when the leak is fixed the test will pass.


More information about the Catalyst-dev mailing list