Simple interface for tracking memory consumption.
$t = new Horde_Support_Memory; $t->push(); $used = $t->pop();
Do not expect too much of this memory tracker. Profiling memory is not trivial as your placement of the measurements may obscure important information. As a trivial example: Assuming that your script used 20 MB of memory befory you call push() the information you get when calling pop() might only tell you that there was less than 20 MB of memory consumed in between the two calls. Take the changes to internal memory handling of PHP in between the different versions into account (http://de3.php.net/manual/en/features.gc.performance-considerations.php) and you should get an idea about why you might be cautious about the values you get from this memory tracker.
Copyright 2011-2012 Horde LLC (http://www.horde.org/)
Located at Horde/Support/Memory.php