php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67725 PHPNG: memory leak when including files
Submitted: 2014-07-31 12:27 UTC Modified: 2014-07-31 14:03 UTC
From: pascal dot chevrel at free dot fr Assigned: dmitry (profile)
Status: Closed Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2014-07-31 12:27 UTC] pascal dot chevrel at free dot fr
Description:
------------
The script includes a file in a loop, the file is a big (tens of thousands of lines) php array.

If you run the script in PHP 5.5 or earlier, the memory consumption at each loop iteration remains stable (about 6MB).

If you run it with PHPNG, the memory consumption adds up with every iteration and me hit a memory limit quickly, it seems the memory used by the array in the include ($tmx) is not freed when it is replaced by a new $tmx array.

Test script:
---------------
I put a repository exposing the bug here:
https://github.com/pascalchevrel/PHPNG_memory_bug


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-31 14:03 UTC] nikic@php.net
-Assigned To: +Assigned To: dmitry
 [2014-07-31 14:03 UTC] nikic@php.net
Looks like an issue with immutable arrays, which won't get destroyed until end of request.
 [2014-08-05 11:40 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ce1af1e47bebb5ebbc2aa8f7a0b4dfb91ef8d327
Log: Fixed bug #67725 (now we create immutable arrays only in SHM)
 [2014-08-05 11:40 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2014-08-15 05:02 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ce1af1e47bebb5ebbc2aa8f7a0b4dfb91ef8d327
Log: Fixed bug #67725 (now we create immutable arrays only in SHM)
 [2016-07-20 11:40 UTC] davey@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ce1af1e47bebb5ebbc2aa8f7a0b4dfb91ef8d327
Log: Fixed bug #67725 (now we create immutable arrays only in SHM)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 05:01:30 2024 UTC