php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40800 cannot disable memory_limit with -1
Submitted: 2007-03-14 06:44 UTC Modified: 2007-03-14 11:58 UTC
From: php at vicaya dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.1 OS: Linux 64-bit
Private report: No CVE-ID:
 [2007-03-14 06:44 UTC] php at vicaya dot com
Description:
------------
According to the documentation: http://us2.php.net/manual/en/ini.core.php

"Note that to have no memory limit, set this directive to -1."

But the code use more than 4GB virtual memory crashes with "Fatal error: Allowed memory size of -1 bytes exhausted (tried to allocate 605 bytes) in ..." anyway.

Reproduce code:
---------------
<? count(file("a_10GB_file")) ?> // not production code :)
on a machine with enough ram and swap space.


Expected result:
----------------
number of lines in "a_10GB_file".

Actual result:
--------------
"Fatal error: Allowed memory size of -1 bytes exhausted (tried to allocate 605 bytes) in ..."

Suspect that memory limit directive is still a 32bit unsigned integer (size_t) and -1 is converted to 4G-1.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-14 10:21 UTC] php at vicaya dot com
USE_ZEND_ALLOC=0 php... seems to workaround the limit.
 [2007-03-14 11:58 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 09:02:28 2014 UTC