[xdebug-general] Re: profiling memory usage

From: Benson, Geoff <geoff[@]xfire.com>
Date: Mon, 17 Mar 2008 15:42:59 -0700



I'm writing because I was working with Chad Walker on getting memory
profiling to work under xdebug, so this is a follow-up to that message.


I have put an archive with the two modified files required to enable
memory profiling in xdebug at
http://www.bebs.net/~xaroth/xdebug_patch.zip . It's 4.7k, so a quick


It appears that the code in 2.0.0RC4 was close, but not quite right in
calculating memory diffs between function calls for output, which is
what was producing the strange visualizations in KCacheGrind.
Specifically, it was disallowing negative memory deltas (which are
perfectly legal as things are freed), and was organized in a way that
may have been concealing other bugs.


My additions to these files simply take the approach of mimicking the
time delta information, since that is calculated correctly and organized
well within the code. In this manner, the memory profiling data
generated for KCacheGrind appears to be correct based on some quick
acceptance testing with simple scripts. I've already started using it
to profile existing code, and it looks fabulous!


These modifications are based on the CVS checkout current as of 2/25/08
(2.1dev). This code has only been tested on CentOS 4.5, with PHP 5.2.3
running on Apache 2.0.59, with PHP memory limits enabled. However, it
is expected to work everywhere that xdebug normally does.


Please consider this code for inclusion in the next release of xdebug.



  --Geoff Benson


PS: This is my third attempt to send this message, but my first as a
full subscriber to the list. It may be worthwhile to add a note to the
webpage that moderated messages to the list are unlikely to be read in a
timely fashion. I apologize in advance if my two previous attempts at
this message suddenly come through to the list when the moderated
message queue is handled.




On Wed, 20 Feb 2008, Walker, Chad wrote:


> I see there was some problem with the memory part of the profiling

> in xdebug, and so it was removed in 2.0RC4. Is it a solvable problem,

> and you just haven't had the time? I built 2.0RC3 from cvs and

> there is some memory information there. I see you called

> zend_memory_usage(), is that not accurate? Is there anything I can do

> help get memory usage back into profiling?


The data that Xdebug gathers is accurate, it's more that kcachegrind

isn't very good at displaying this information.


(PS: Please use the mailinglist)




Received on Mon Mar 17 2008 - 23:52:50 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST