Annotation of embedaddon/php/Zend/tests/bug55509.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #55509 (segfault on x86_64 using more than 2G memory)
3: --SKIPIF--
4: <?php
5: if (PHP_INT_SIZE == 4) {
6: die('skip Not for 32-bits OS');
7: }
8: if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
9: // check the available memory
10: if (PHP_OS == 'Linux') {
11: $lines = file('/proc/meminfo');
12: $infos = array();
13: foreach ($lines as $line) {
14: $tmp = explode(":", $line);
15: $index = strtolower($tmp[0]);
16: $value = (int)ltrim($tmp[1], " ")*1024;
17: $infos[$index] = $value;
18: }
19: $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
20: if ($freeMemory < 2100*1024*1024) {
21: die('skip Not enough memory.');
22: }
23: }
24: elseif (PHP_OS == 'FreeBSD') {
25: $lines = explode("\n",`sysctl -a`);
26: $infos = array();
27: foreach ($lines as $line) {
28: if(!$line){
29: continue;
30: }
31: $tmp = explode(":", $line);
32: $index = strtolower($tmp[0]);
33: $value = trim($tmp[1], " ");
34: $infos[$index] = $value;
35: }
36: $freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
37: +($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
38: +($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
39: if ($freeMemory < 2100*1024*1024) {
40: die('skip Not enough memory.');
41: }
42: }
43: ?>
44: --INI--
45: memory_limit=2100M
46: --FILE--
47: <?php
48: $a1 = str_repeat("1", 1024 * 1024 * 1024 * 0.5);
49: echo "1\n";
50: $a2 = str_repeat("2", 1024 * 1024 * 1024 * 0.5);
51: echo "2\n";
52: $a3 = str_repeat("3", 1024 * 1024 * 1024 * 0.5);
53: echo "3\n";
54: $a4 = str_repeat("4", 1024 * 1024 * 1024 * 0.5);
55: echo "4\n";
56: $a5 = str_repeat("5", 1024 * 1024 * 1024 * 0.5);
57: echo "5\n";
58: ?>
59: --EXPECTF--
60: 1
61: 2
62: 3
63: 4
64:
65: Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %sbug55509.php on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>