From: louis at steelbytes dot com
Operating system: windows
PHP version: 5.2.6
PHP Bug Type: Performance problem
Bug description: some string funcs need unexpectedly high memory_limit
Description:
------------
the following code fails with
Fatal error: Allowed memory size of 587896 bytes exhausted (tried to
allocate 262145 bytes)
command:
php.exe -n -f memuse.php
memuse.php:
@ob_end_flush();
@ob_implicit_flush(1);
define('big_size',256*1024);
define('saftey',4*1024);
ini_set('memory_limit',memory_get_usage()+big_size*2+saftey);
$big = str_repeat('x',big_size);
yet if I change big_size to 1024*1024, then it works?
and a simlar script
@ob_end_flush();
@ob_implicit_flush(1);
define('big_size',200*1024);
define('saftey',4*1024);
ini_set('memory_limit',memory_get_usage()+big_size+saftey);
echo str_repeat('x',big_size);
also fails, yet if I change big_size to 180*1024 then it works?
PS, note that in the first script I set mem limit to 2 times big_size, and
in the 2nd script I did not.
Reproduce code:
---------------
see above
Expected result:
----------------
see above
Actual result:
--------------
see above
--
Edit bug report at http://bugs.php.net/?id=45296&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45296&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45296&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45296&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45296&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45296&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45296&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45296&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45296&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45296&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45296&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45296&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45296&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45296&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45296&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45296&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45296&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45296&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45296&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45296&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45296&r=mysqlcfg