[Pdx-pm] Recommendations for memory leak checking?

Tom Phoenix rootbeer at redcat.com
Tue Jul 3 15:03:32 PDT 2007

On 7/3/07, Kevin Scaldeferri <kevin at scaldeferri.com> wrote:

> Does anyone have a memory leak checking module they particularly
> recommend at the moment?  My required usage demands something that
> doesn't require that I modify my code at all.  I want to be able to
> just load the module from the commandline when running unit tests.
> So, just like you can run Devel::Cover on your unit tests like:
> HARNESS_PERL_SWITCHES="-MDevel::Cover" make test
> I would like to do the same to check for memory leaks.

But coverage can be checked programmatically. I don't think there's a
way to be sure (without applying a brain to the problem) that you'll
never again need a particular allocated chunk of memory, until it's
the end of the program and you didn't. Although some special cases can
be detected, and some software can catch many of these special cases.

If there's a particular something that you think is getting allocated
and not deallocated, you can track what happens to those particular
somethings. But if you're looking everywhere in the forest of perl
core + extensions + your OS for memory leaks, it's a formidable task.

Of course, if you're programming in pure Perl, you shouldn't generally
have to worry about leaking memory. You should have to worry only
about buying memory. :-)

I hope somebody follows up to say that there's some wonderful memory
leak tool that I've never heard of. But I think you're looking for
something that may not exist.

Good luck with your project!

--Tom Phoenix

More information about the Pdx-pm-list mailing list