[Catalyst-dev] Need help debugging Text::ASCIITable
Perrin Harkins
perrin at elem.com
Mon Sep 26 17:03:17 CEST 2005
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.
- Perrin
More information about the Catalyst-dev
mailing list