Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by jeffreykegler (8827) on 2008.09.09 12:55 (#64819)
    Perhaps you'll find Test::Weaken helpful. There's one routine, poof(). You give it a subroutine that creates your object, it runs the subroutine and frees the return values, then examines them to see which haven't actually been freed.

    This sounds contradictory, but the trick Test::Weaken uses is weak references -- that way you try to free something, but still have a reference to anything that didn't get freed. Most useful for you might be that poof() returns a list of the objects which didn't get freed and you can actually examine them. If that's enough to tell you where they were created, you're done. Otherwise, you can trying adding tags that let you know where the object came from.

    Ignore the warning that it's alpha software. I've used Test::Weaken a lot. It's part of the Parse::Marpa regression test and has caught a lot of leaks for me. Some day soon I'll change the documentation to describe Test::Weaken as released.

    hope this helps,

    jeffrey kegler