Documentation

Memory
in package

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/)

Tags
category

Horde

license

http://www.horde.org/licenses/bsd

Table of Contents

$_idx  : int
Current index for stacked trackers.
$_start  : array<string|int, mixed>
Holds the starting memory consumption.
pop()  : array<string|int, mixed>
Pop the latest tracker and return the difference with the current memory situation.
push()  : mixed
Push a new tracker on the stack.

Properties

$_idx

Current index for stacked trackers.

protected int $_idx = 0

$_start

Holds the starting memory consumption.

protected array<string|int, mixed> $_start = []

Methods

pop()

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

public pop() : array<string|int, mixed>
Return values
array<string|int, mixed>

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(),

push()

Push a new tracker on the stack.

public push() : mixed
Return values
mixed

Search results