Bug #79626 [Opn]: arrow fucntion memory leak
| From: | thedinosaurmail at gmail dot com | Date: | Mon, 25 May 2020 06:40:40 +0000 |
| Subject: | Bug #79626 [Opn]: arrow fucntion memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227145@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79626&edit=1
ID: 79626
User updated by: thedinosaurmail at gmail dot com
Reported by: thedinosaurmail at gmail dot com
-Summary: memory leak
+Summary: arrow fucntion memory leak
Status: Open
Type: Bug
Package: *General Issues
Operating System: ubuntu 16.
PHP Version: 7.4.6
Block user comment: N
Private report: N
New Comment:
the same problem with it
https://bugs.php.net/bug.php?id=76982
Previous Comments:
------------------------------------------------------------------------
[2020-05-25 06:35:38] thedinosaurmail at gmail dot com
Description:
------------
arrow function and anonymous functions should be garbage collect ,but it seems be the full life
cycle
it may relative with this
https://github.com/php/php-src/blob/f3efb9e3fb30fa307e0913e888fb2859cec8209a/Zend/zend_compile.c#L6271
Test script:
---------------
// file1.php
<?php
for ($i = 0; $i < 1000000; $i++)
{
require('file2.php');
}
// file2.php
<?php
$fn1 = fn($x) => $x + $y;
above wil oom
---------
below will not oom
// file3.php
<?php
for ($i = 0; $i < 1000000; $i++)
{
$fn1 = fn($x) => $x + $y;
}
Expected result:
----------------
not report fatal error
Actual result:
--------------
Fatal error: Allowed memory size of 134217728 bytes exhausted at /root/php-src/Zend/zend_hash.c:149
(tried to allocate 384 bytes) in /home/dinosaur/test/php746/bin/file2.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79626&edit=1