[drupal-devel] Profiling memory consumption (was TCPHP goes for Drupal)

Matt Westgate matt at asitis.org
Sat May 28 15:44:11 UTC 2005


On Saturday 28 May 2005 01:43 am, Dries Buytaert wrote:
> I have been thinking about profiling Drupal's memory consumption.
> I'd like know where most memory is consumed.  Is there an easy way to
> profile this?

I used Xdebug 2.0 (beta) [1] and KCachegrind to profile the path aliasing 
patch a couple weeks back. Xdebug outputs a ' Callgrind Profile Format' file 
which can be read into programs like KCachegrind [2] or WinCacheGrind [3].  
It allowed me to see memory usage and the time spent in functions.  The 
memory footprint in HEAD is already smaller than 4.6 since we got rid of 
storing all aliases in a static variable.

I ran a quick profile on a 4.6 site (with no aliases) and it seems the next 
place to focus on would be drupal_load() in terms on memory usage.

http://www.asitis.org/tmp/drupal_load-memory.png

And here's how time is spent inside that function:

http://www.asitis.org/tmp/drupal_load-time.png

I don't know if this is the best way to profile memory usage, but it seems to 
give us the information we're after.

Matt

[1] Xdebug: This site is slower than molasses. - http://xdebug.org/
[2] KCachegrind - http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/
[3] WinCacheGrind - http://dev.gauldong.net/mambo/content/view/25/52/



More information about the drupal-devel mailing list