From: camka at email dot ee
Operating system: Linux
PHP version: 4.3.10
PHP Bug Type: *General Issues
Bug description: memory_limit doesn't word
Description:
------------
php compiled with --enable-memory-limit, but setting the value of
memory_limit more then certain number won't affect scripts.
tried set the value of memory_limit in both php.ini and script body -
nothing helped.
Reproduce code:
---------------
<?php
echo ini_get('memory_limit'),"\n";
ini_set('memory_limit', 100000000);
echo ini_get('memory_limit'),"\n";
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
function a()
{
echo 'fck oyu!';
}
register_shutdown_function('a');
$zz = 'u';
for($i=1; $i<1000; $i++)
{
$zz .= $zz;
echo $i,' - ', memory_get_usage(),"<br>\n";flush();
}
?>
Expected result:
----------------
allocate at least 100MB of memory and die if exceeded.
Actual result:
--------------
100M
100000000
1 - 12912<br>
2 - 12912<br>
3 - 12920<br>
4 - 12944<br>
5 - 12960<br>
6 - 13032<br>
7 - 13096<br>
8 - 13224<br>
9 - 13480<br>
10 - 13992<br>
11 - 15016<br>
12 - 17064<br>
13 - 21160<br>
14 - 29352<br>
15 - 45736<br>
16 - 78504<br>
17 - 144040<br>
18 - 275112<br>
19 - 537256<br>
20 - 1061544<br>
21 - 2110120<br>
22 - 4207272<br>
23 - 8401576<br>
error_log:
FATAL: erealloc(): Unable to allocate 16777217 bytes
--
Edit bug report at http://bugs.php.net/?id=32318&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32318&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32318&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32318&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32318&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32318&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32318&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32318&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32318&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32318&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32318&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32318&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32318&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32318&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32318&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32318&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32318&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32318&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32318&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32318&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32318&r=mysqlcfg