调试 PHP 内存泄漏。跟踪引用计数?

发布于 2024-12-17 05:23:12 字数 132 浏览 3 评论 0原文

我有一个相当大的 PHP 脚本,该脚本正在泄漏内存。我已经能够找出哪个对象正在泄漏,但我无法找出脚本中的何处泄漏。我的脚本的某些部分保留对泄漏对象的引用。

有什么方法可以跟踪(最好是回溯)PHP 对象的引用计数在何处/何时增加或减少?

I have a rather large PHP script that is leaking memory. I have been able to figure out what object is leaking, but I have not been able to find out where in the script it is leaking. Some part of my script is keeping a reference to the leaking object.

Is there some way that I can track (and preferably backtrace) where/when a PHP object has it's reference count increased or decreased?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

喵星人汪星人 2024-12-24 05:23:12

您可以使用分析工具来找出内存泄漏的原因,我更喜欢 http://xdebug.org/http://code.google.com/p/webgrind

http://derickrethans.nl/xdebug-and-tracing-memory-usage.html

You can use profiling tools to find out what is leaking your memory i prefer http://xdebug.org/ and http://code.google.com/p/webgrind

http://derickrethans.nl/xdebug-and-tracing-memory-usage.html

浸婚纱 2024-12-24 05:23:12

尝试使用:

另外,我建议以易于使用的方式编写代码调试方式,将调试过程与代码分离。

Try to use:

Also, I suggest to write the code in a easy-to-debug manner and separate the debugging procedures from the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文