开发者

Memory Leak tool for PHP? Using LAMP

Anyone know a good tool for discovery of memleaks for PHP? I can use either client o开发者_Go百科r server side. Thanks


You shouldn't need to manage memory for most applications. This isn't C. However, with that said, I'm assuming you have a good reason to need a memory leak detector in PHP. This article explains memory usage in a slightly outdated (but still relevant) version of PHP. Scroll down to the "Memory management functions in PHP" section for built-in memory management functions.

Here's an overview of the most popular ones:

  1. memory_get_usage: Gets the total bytes used by the current PHP script
  2. memory_get_peak_usage: Gets the maximum bytes used by the current PHP script
  3. ini_get('memory_limit'): Gets the maximum amount of bytes allowed by the current PHP script


I suggest you XDebug and perhaps adding xhprof.

Not hard to implement, easy to work and very nice way to visualize and find leaks (both in time and memory).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜