From c67c8cb96508001d455b1d0036de360f19ec566d Mon Sep 17 00:00:00 2001 From: Ferenc Kovacs Date: Sun, 23 Oct 2011 00:07:01 +0000 Subject: [PATCH] check the available memory on linux and skip if it is not enough --- Zend/tests/bug55509.phpt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index d9957cd5fb..3f8657facd 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -5,6 +5,21 @@ Bug #55509 (segfault on x86_64 using more than 2G memory) if (PHP_INT_SIZE == 4) { die('skip Not for 32-bits OS'); } +// check the available memory +if (PHP_OS == 'Linux') { + $lines = file('/proc/meminfo'); + $infos = array(); + foreach ($lines as $line) { + $tmp = explode(":", $line); + $index = strtolower($tmp[0]); + $value = (int)ltrim($tmp[1], " ")*1024; + $infos[$index] = $value; + } + $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached']; + if ($freeMemory < 2100*1024*1024) { + die('skip Not enough memory.'); + } +} ?> --INI-- memory_limit=2100M -- 2.50.1