日期:2014-05-17 浏览次数:20462 次
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 10255856 bytes) in /usr/local/asg/www/scripts/sync.php on line 641
$arr = array();
for($i=0;$i=1590000;$i++) {
$arr[] = $i;
}
echo count($arr);
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in D:\server\www\02\array.php on line 5
$arr = array();
for($i=0;$i<1550000;$i++) {
$arr[] = $i;
}
echo count($arr);
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 512M
$t = 0;
echo memory_get_usage() - $t, ' ',$t = memory_get_usage(), PHP_EOL;
$a = array();
echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
$a[] = 1;
echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
$a[] = 2;
echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;
$a[] = 3;
echo memory_get_usage() - $t, ' ', $t = memory_get_usage(), PHP_EOL;