ID: 49501
Updated by: jani@php.net
Reported By: romain dot riviere at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: *General Issues
Operating System: Gentoo Linux 32bit / PaX
PHP Version: 5.2.10
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2009-09-10 06:44:18] romain dot riviere at gmail dot com
I was able to reproduce the problem even with the latest sources. I am
beginning to suspect PaX/GrSecurity.
Are there any catches to be aware of when running PHP in that context ?
I know of the --with-pic/TEXTREL issue, but apparently there must be
something else to it.
------------------------------------------------------------------------
[2009-09-09 19:43:33] jani@php.net
And make sure you really do simply this:
1. Unpack sources
2. ./configure --disable-all --disable-cgi && make
3 run the test script with 'sapi/cli/php -n -d memory_limit=128M
yourscript.php
------------------------------------------------------------------------
[2009-09-09 19:42:25] jani@php.net
Please try using this snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
I can not reproduce this at all on several different servers running
latest svn checkout.
------------------------------------------------------------------------
[2009-09-09 15:28:04] romain dot riviere at gmail dot com
The problem still happens without --enable-debug.
I could reproduce the bug in CLI with a simple while(true). More
specifically (and with memory_limit=128M this time):
<?php
ini_set('display_errors',true);
if (isset($_GET['size']) && $_GET['size'] < 200) {
$mb = intval($_GET['size']);
}
else {
$mb=125;
}
while(true) {
$var = '';
echo 'Memory limit: '.ini_get('memory_limit').'<br>';
for ($i=0; $i<=$mb; $i++) {
$var.= str_repeat('a',1*1024*1024);
echo memory_get_usage().'<br>';
}
echo 'String length: '. strlen($var);
}
?>
This script crashes after a few iterations with the message:
Fatal error: Out of memory (allocated 123469824) (tried to allocate
122683393 bytes) in /home/acrm/OF-svn/2.0/test.php on line 14
zend_mm_heap corrupted
The memory_get_usage() output increases until it busts the 128M limit.
Now, I'm not too familiar with PHP's memory management, but I find it
strange that the script should hog memory that way: shouldn't it free
some RAM when $var is reset to '' ?
At any rate, the initial issue remains, whether this one is related or
not.
------------------------------------------------------------------------
[2009-09-09 09:41:59] jani@php.net
You also seem to be using --enable-debug, does it happen without it?
And can you reproduce the same on command line?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/49501--
Edit this bug report at http://bugs.php.net/?id=49501&edit=1