PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Memory Manager Settings

Memory Limit

Memory limit is a number of bytes allowed to be used by loaded movable objects.

If loading or creation of an object causes memory usage to exceed of this limit, then the memory manager swaps some other objects.

You can retrieve or set the memory limit setting using the getMemoryLimit() and setMemoryLimit($newLimit) methods:

<?php
$oldLimit 
$memoryManager->getMemoryLimit();  // Get memory limit in bytes
$memoryManager->setMemoryLimit($newLimit);     // Set memory limit in bytes

A negative value for memory limit means 'no limit'.

The default value is two-thirds of the value of 'memory_limit' in php.ini or 'no limit' (-1) if 'memory_limit' is not set in php.ini.

MinSize

MinSize is a minimal size of memory objects, which may be swapped by memory manager. The memory manager does not swap objects that are smaller than this value. This reduces the number of swap/load operations.

You can retrieve or set the minimum size using the getMinSize() and setMinSize($newSize) methods:

<?php
$oldMinSize 
$memoryManager->getMinSize();  // Get MinSize in bytes
$memoryManager->setMinSize($newSize);        // Set MinSize limit in bytes

The default minimum size value is 16KB (16384 bytes).

Zend Framework