views:

766

answers:

2

I am using ActiveState Perl 5.6 on a Windows 2003 Server, and am having some memory leak issues. Are there any good tools (or even bad tools which would give a clue) which I would be able to use to help find them.

+9  A: 

All perl program memory leaks will either be an XS holding onto a reference, or a circular data structure. Devel::Cycle is a great tool for finding circular references, if you know what structures are likely to contain the loops. Devel::Peek can be used to find objects with a higher-than-expected reference count.

If you don't know where else to look, Devel::LeakTrace::Fast could be a good first place, but you'll need a perl built for debugging.

If you suspect the leak is inside XS-space, it's much harder, and Valgrind will probably be your best bet. Test::Valgrind may help you lower the amount of code you need to search, but this won't work on Windows, so you'd have to port (at least the leaky portion) to Linux in order to do this.

geocar
+1  A: 

Devel::Gladiator will show you a list of how many of each variable type Perl has in memory at any given time, and what they are references to. Very useful for figuring out what type of objects are being created but not freed.

Ryan Olson