[Pdx-pm] Recommendations for memory leak checking?

Eric Wilhelm scratchcomputing at gmail.com
Tue Jul 3 15:03:07 PDT 2007


# from Michael G Schwern
# on Tuesday 03 July 2007 01:52 pm:

>> HARNESS_PERL_SWITCHES="-MDevel::Cover" make test
>>
>> I would like to do the same to check for memory leaks.
>
>Test::Memory::Cycle can check individual objects and references for
> memory leaks.
>
>Otherwise there's Devel::Leak which I've never really had luck with.

I also see Devel::LeakTrace.

I haven't tried either of those, but it sounds like neither would really 
give the sort of harnessed usage Kevin wants (which sounds like it 
would be a good thing.)

Possibly something that just makes noise during global cleanup?  Here 
I'm thinking mainly about lexicals (I believe any globals have to be 
cleaned-up at the end and I guess their leakage doesn't matter anyway, 
right?)

  BEGIN {do {"./t/this.t"}; }
  END { print STDERR ">>>THIS IS THE END<<<\n";}
  *UNIVERSAL::DESTROY = sub {
    print STDERR "$_[0] is leaky\n";
  };

Combine that basic scheme with several pages of the perl hacks book and 
you'll get to be the presenter at the August meeting :-D

--Eric
-- 
[...proprietary software is better than gpl because...] "There is value
in having somebody you can write checks to, and they fix bugs."
--Mike McNamara (president of a commercial software company)
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list