有什么工具可以在我的Perl程序中查找内存泄漏? [英] Are there any tools for finding memory leaks in my Perl program?

查看:93
本文介绍了有什么工具可以在我的Perl程序中查找内存泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 2003 Server上使用ActiveState Perl 5.6,并且遇到一些内存泄漏问题.有什么我可以用来帮助找到它们的好工具(甚至可以提供线索的坏工具).

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.

推荐答案

所有perl程序内存泄漏将是保留引用的XS或循环数据结构.如果您知道什么结构, Devel :: Cycle 是查找循环引用的好工具可能包含循环. Devel :: Peek 可用于查找参考值高于预期的对象计数.

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.

如果您不知道其他位置,请 Devel :: LeakTrace :::快速可能是很好的第一名,但是您需要为调试创建一个perl.

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.

如果您怀疑泄漏发生在XS空间内,则难度要大得多, Valgrind 可能是您最好的选择. Test :: Valgrind 可以帮助您减少需要搜索的代码量,但是这在Windows上将不起作用,因此您必须(至少要泄漏部分)移植到Linux上.

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.

这篇关于有什么工具可以在我的Perl程序中查找内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆