[Pdx-pm] Recommendations for memory leak checking?

Eric Wilhelm scratchcomputing at gmail.com
Wed Jul 4 00:47:13 PDT 2007


# from Kevin Scaldeferri
# on Tuesday 03 July 2007 11:21 pm:

>>   BEGIN {do {"./t/this.t"}; }
>>   END { print STDERR ">>>THIS IS THE END<<<\n";}
>>   *UNIVERSAL::DESTROY = sub {
>>     print STDERR "$_[0] is leaky\n";
>>   };
>
>I think that would only detect leaks of objects, right?  I'd like to  
>detect leaks of normal variables as well.

Yep, only objects.  That suggestion is also limited in that it would 
need to be told "oh, those are ok" if there's a package lexical or 
package global being destroyed at the END.  (And from a simple test, 
there are going to be some IO::Handle objects and other bits of 
non-trivial magic appearing.)

The code has circular references in lexical non-objects?  That's just 
frightening.

If you're dealing with package variables, they're in the symbol table.

--Eric
-- 
Turns out the optimal technique is to put it in reverse and gun it.
--Steven Squyres (on challenges in interplanetary robot navigation)
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list