#45271 [Opn->Bgs]: php gives negative memory error with memory limit at 2 gig
| From: | derick@php.net | Date: | Sun, 15 Jun 2008 11:49:34 +0000 |
| Subject: | #45271 [Opn->Bgs]: php gives negative memory error with memory limit at 2 gig | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125789@lists.php.net to get a copy of this message | ||
ID: 45271
Updated by: derick@php.net
Reported By: paul at paulscripts dot nl
-Status: Open
+Status: Bogus
-Bug Type: Reproducible crash
+Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.2.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You simply get an integer overflow. The maximum range is from -2gb to
+2gb-1. 2048M is just above this limit so it overflows.
Previous Comments:
------------------------------------------------------------------------
[2008-06-14 19:13:38] paul at paulscripts dot nl
Description:
------------
php gives the next fatal error:
Fatal error: Allowed memory size of -2147483648 bytes exhausted (tried
to allocate 2147221481 bytes) in /root/convert.php on line 6
when trying to use a script with a memory limit of 2gig.
Reproduce code:
---------------
<?php
ini_set('memory_limit', '2048M');
$d = '';
while (true)
{
$d .= 'a';
}
Expected result:
----------------
Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried
to allocate 2147221481 bytes) in /root/convert.php on line 6
Actual result:
--------------
Fatal error: Allowed memory size of -2147483648 bytes exhausted (tried
to allocate 2147221481 bytes) in /root/convert.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45271&edit=1