Categorized | News

Neat Zend Trick

Posted on 12 January 2005 by Demian Turner

If you’re using the Zend IDE or any IDE with a debugger that supports watches, try this one:

number_format(memory_get_usage())

As you step through your code, and memory is allocated line by line and released, for example, when a method returns and its local variables go out of scope, this watch updates with PHP’s current memory usage.

Very handy for profiling bottlenecks – only works when PHP is compiled with –enable-memory-limit on Linux. Thanks to my colleague Chris Nutting for pointing this out.

Bookmark and Share

Leave a Reply

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook