Matt S Trout dbix-class at trout.me.uk
Tue Apr 25 14:28:31 BST 2006

Nik Clayton wrote:
> Dirk Koopman wrote:
>> How does one detect memory leaks in perl?
>> Specifically: I am getting reports that there is some kind of memory
>> leak in a piece of network related pure perl code that I have written.
>> Now, since this is a very old piece of code written when I was less
>> clueful, it would not altogether surprise me.
>> It will some hash with a circular reference that I am not breaking or
>> something like that. Any suggestions as to how to go about finding it?
> Devel::Cycle?
> I saw Test::Memory::Cycle go by on perl-qa the other day.  Not sure if 
> it's on CPAN yet -- if not, the archives should have it.

Test::Memory::Cycle is lovely, with one caveat - it won't spot cycles that go 
through a subref - e.g. $x->{y} = sub { $x };.

What you saw go by on perl-qa a couple days back was Yuval Kogman's patch to 
fix that using PadWalker, prompted by some fun and games during a refactor of 
Catalyst::View::TT :)

      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the london.pm mailing list