Skip to content

Commit

Permalink
Debugger: added $reservedMemorySize [Closes #272]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 18, 2019
1 parent b8fda47 commit b8b9644
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Tracy/Debugger/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class Debugger
/** @var bool whether to send data to FireLogger in development mode */
public static $showFireLogger = true;

/** @var int size of reserved memory */
public static $reservedMemorySize = 500000;

/** @var bool */
private static $enabled = false;

Expand Down Expand Up @@ -152,7 +155,7 @@ public static function enable($mode = null, string $logDirectory = null, $email
self::$productionMode = is_bool($mode) ? $mode : !self::detectDebugMode($mode);
}

self::$reserved = str_repeat('t', 500000);
self::$reserved = str_repeat('t', self::$reservedMemorySize);
self::$time = $_SERVER['REQUEST_TIME_FLOAT'] ?? microtime(true);
self::$obLevel = ob_get_level();
self::$cpuUsage = !self::$productionMode && function_exists('getrusage') ? getrusage() : null;
Expand Down Expand Up @@ -253,7 +256,7 @@ public static function isEnabled(): bool
*/
public static function shutdownHandler(): void
{
if (!self::$reserved) {
if (self::$reserved === null) {
return;
}
self::$reserved = null;
Expand Down Expand Up @@ -283,7 +286,7 @@ public static function shutdownHandler(): void
*/
public static function exceptionHandler(\Throwable $exception, bool $exit = true): void
{
if (!self::$reserved && $exit) {
if (self::$reserved === null && $exit) {
return;
}
self::$reserved = null;
Expand Down

0 comments on commit b8b9644

Please sign in to comment.