天天无天天
也发现了这个问题,追了源码:
在ErrorHandler类里,有这个变量:
/*** @var integer the size of the reserved memory. A portion of memory is pre-allocated so that * when an out-of-memory issue occurs, the error handler is able to handle the error with * the help of this reserved memory. If you set this value to be 0, no memory will be reserved. * Defaults to 256KB.
*/
public $memoryReserveSize = 262144;/** * Register this error handler */ public function register() { ini_set('display_errors', false); set_exception_handler([$this, 'handleException']); if (defined('HHVM_VERSION')) { set_error_handler([$this, 'handleHhvmError']); } else { set_error_handler([$this, 'handleError']); } if ($this->memoryReserveSize > 0) { $this->_memoryReserve = str_repeat('x', $this->memoryReserveSize); } register_shutdown_function([$this, 'handleFatalError']); }
因为php没有用户主动分配内存的机制,所以,为了内存溢出也能抛出错误,预留了26w个x预先占用了内存。。。
是不是很冷,哈哈