reservedMemory = str_repeat(' ', 1024 * 256); register_shutdown_function(function () { $this->reservedMemory = null; $lastError = error_get_last(); if (!$lastError) { return; } $isOom = preg_match($this->oomRegex, $lastError['message'], $matches) === 1; if (!$isOom) { return; } /** @var \Bugsnag\Client|null $client */ $client = app('bugsnag'); // If the client exists and memory increase is enabled, bump the // memory limit so we can report it. The client can be missing when // the container isn't complete, e.g. when unit tests are running if ($client && $client->getMemoryLimitIncrease() !== null) { $currentMemoryLimit = (int) $matches[1]; ini_set('memory_limit', $currentMemoryLimit + $client->getMemoryLimitIncrease()); } }); } }