Req #60982 [Com]: GC not called prior to memory exhausted error
Edit report at https://bugs.php.net/bug.php?id=60982&edit=1
ID: 60982
Comment by: arjen at react dot com
Reported by: developerguy2008 at yahoo dot com
Summary: GC not called prior to memory exhausted error
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.4.0RC7
Block user comment: N
Private report: N
New Comment:
Slightly related to https://bugs.php.net/bug.php?id=41245 (Ability to
set handler for "memory limit exceeded")
Previous Comments:
------------------------------------------------------------------------
[2012-02-06 00:06:51] developerguy2008 at yahoo dot com
Description:
------------
This affects all versions of PHP. In a script that is about to run out of memory,
gc_collect_cycles() should be called as this can sometimes prevent the script from running out of
memory.
Example:
I have a non-blocking server I wrote in PHP. If there are several thousand connections, the script
will run out of memory. However, if the exact same script with the exact same load (using apache
benchmark) is run while calling gc_collect_cycles() every half second, there are no out-of-memory
issues.
Test script:
---------------
The source code for PHP will reveal that garbage collection is not run as a last ditch effort to
continue execution within the memory constraints specified by the user.
Expected result:
----------------
I expect PHP to run garbage collection when memory is nearly exhausted to prevent a memory error.
Actual result:
--------------
PHP will exhaust memory even when it is not necessary for it to exhaust memory.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60982&edit=1
Thread (3 messages)