From 4048d27b565c2d5cbfacc8c11a81ab044f44da1b Mon Sep 17 00:00:00 2001 From: Hossein Hosni Date: Tue, 16 Dec 2025 11:17:43 +0330 Subject: [PATCH] Cast Server used memory division result to int for Linux Fixes: https://github.com/laravel/pulse/issues/472 --- src/Recorders/Servers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Recorders/Servers.php b/src/Recorders/Servers.php index 5dc0cca3..6e31ba6e 100644 --- a/src/Recorders/Servers.php +++ b/src/Recorders/Servers.php @@ -136,7 +136,7 @@ protected function memory(): array $memoryUsed = match (PHP_OS_FAMILY) { 'Darwin' => $memoryTotal - intval(intval(shell_exec("vm_stat | grep 'Pages free' | grep -Eo '[0-9]+'")) * intval(shell_exec('pagesize')) / 1024 / 1024), // MB - 'Linux' => $memoryTotal - intval(shell_exec("cat /proc/meminfo | grep MemAvailable | grep -E -o '[0-9]+'")) / 1024, // MB + 'Linux' => $memoryTotal - intval(intval(shell_exec("cat /proc/meminfo | grep MemAvailable | grep -E -o '[0-9]+'")) / 1024), // MB 'Windows' => $memoryTotal - intval(((int) trim((string) shell_exec('wmic OS get FreePhysicalMemory | more +1'))) / 1024), // MB 'BSD' => intval(intval(shell_exec("( sysctl vm.stats.vm.v_cache_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_inactive_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_active_count | grep -Eo '[0-9]+' ) | awk '{s+=$1} END {print s}'")) * intval(shell_exec('pagesize')) / 1024 / 1024), // MB default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),