/** * Get memory limit * * If the used memory of PHP exceeds this limit an OutOfCapacityException * will be thrown. * * @return int */ public function getMemoryLimit() { if ($this->memoryLimit === null) { $memoryLimit = Utils::bytesFromString(ini_get('memory_limit')); if ($memoryLimit >= 0) { $this->memoryLimit = floor($memoryLimit / 2); } else { // disable memory limit $this->memoryLimit = 0; } } return $this->memoryLimit; }
/** * Get memory limit * * If the used memory of PHP exceeds this limit an OutOfCapacityException * will be thrown. * * @return int */ public function getMemoryLimit() { if ($this->memoryLimit === null) { $memoryLimit = Utils::bytesFromString(ini_get('memory_limit')); if ($memoryLimit >= 0) { $this->memoryLimit = floor($memoryLimit / 2); } else { // use a hard memory limit of 32M if php memory limit is disabled $this->memoryLimit = 33554432; } } return $this->memoryLimit; }
/** * Get memory limit * * If the used memory of PHP exceeds this limit an OutOfSpaceException * will be thrown. * * @return int */ public function getMemoryLimit() { if ($this->memoryLimit === null) { // By default use half of PHP's memory limit if possible $memoryLimit = Utils::bytesFromString(ini_get('memory_limit')); if ($memoryLimit >= 0) { $this->memoryLimit = floor($memoryLimit / 2); } else { // disable memory limit $this->memoryLimit = 0; } } return $this->memoryLimit; }