\Horde_Support_Memory

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-2017 Horde LLC (http://www.horde.org/)

Summary

Methods
Properties
Constants
push()
pop()
No public properties found
No constants found
No protected methods found
$_start
$_idx
N/A
No private methods found
No private properties found
N/A

Properties

$_start

$_start : array

Holds the starting memory consumption.

Type

array

$_idx

$_idx : integer

Current index for stacked trackers.

Type

integer

Methods

push()

push() 

Push a new tracker on the stack.

pop()

pop() : array

Pop the latest tracker and return the difference with the current memory situation.

Returns

array —

The change in memory allocated via emalloc() in between the push() and the pop() call. The array holds four values: the first one indicates the change in current usage of memory while the second value indicates any changes in the peak amount of memory used. The third and fourth value show current and peak usage as well but indicate the real memory usage and not just the part allocated via emalloc(),