]> _ Git - cubist_util.git/commitdiff
wip #6629
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 15 Jan 2024 16:15:58 +0000 (17:15 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 15 Jan 2024 16:15:58 +0000 (17:15 +0100)
src/PHP.php

index 7c8f562210586690fde978703451166b9171539c..b3d5ccd0a712034fe2dc891ea3a2a50592879333 100644 (file)
@@ -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');
         }