Overview

Packages

  • Support

Classes

  • Horde_Support_Array
  • Horde_Support_Backtrace
  • Horde_Support_CombineStream
  • Horde_Support_ConsistentHash
  • Horde_Support_Guid
  • Horde_Support_Inflector
  • Horde_Support_Memory
  • Horde_Support_Numerizer
  • Horde_Support_Numerizer_Locale_Base
  • Horde_Support_Numerizer_Locale_De
  • Horde_Support_Numerizer_Locale_Pt
  • Horde_Support_Randomid
  • Horde_Support_Stack
  • Horde_Support_StringStream
  • Horde_Support_Stub
  • Horde_Support_Timer
  • Horde_Support_Uuid
  • Overview
  • Package
  • Class
  • Tree

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

Package: Support
Category: Horde
License: http://www.horde.org/licenses/bsd
Located at Horde/Support/Memory.php
Methods summary
public
# push( )

Push a new tracker on the stack.

Push a new tracker on the stack.

public array
# pop( )

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

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

API documentation generated by ApiGen