From: Vincent Vanwaelscappel Date: Mon, 15 Jan 2024 16:15:58 +0000 (+0100) Subject: wip #6629 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=191a19a0a44b0fa4c41f49be70e0f83b64fd1f2c;p=cubist_util.git wip #6629 --- diff --git a/src/PHP.php b/src/PHP.php index 7c8f562..b3d5ccd 100644 --- a/src/PHP.php +++ b/src/PHP.php @@ -22,9 +22,9 @@ class PHP ini_set("memory_limit", $amount); } - public static function isCloseToMemoryLimit($throw = false) + public static function isCloseToMemoryLimit($throw = false, $ratio = 0.9) { - $res = (memory_get_usage() / Math::toBytes(ini_get('memory_limit'))) > 0.9; + $res = (memory_get_usage() / Math::toBytes(ini_get('memory_limit'))) > $ratio; if ($throw && $res) { throw new \Exception('Memory is close to the limit'); }