Are there any tools for finding memory leaks in my Perl program?

后端 未结 3 933
抹茶落季
抹茶落季 2020-12-05 08:43

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

3条回答
  •  青春惊慌失措
    2020-12-05 09:29

    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.

提交回复
热议问题