Bug #79626 [Opn->Dup]: arrow fucntion memory leak
| From: | cmb@php.net | Date: | Mon, 25 May 2020 07:04:04 +0000 |
| Subject: | Bug #79626 [Opn->Dup]: arrow fucntion memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-227146@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
Updated by: cmb@php.net
Reported by: thedinosaurmail at gmail dot com
Summary: arrow fucntion memory leak
-Status: Open
+Status: Duplicate
Type: Bug
-Package: *General Issues
+Package: Scripting Engine problem
Operating System: ubuntu 16.
PHP Version: 7.4.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Indeed, duplicate of bug #76982.
Previous Comments:
------------------------------------------------------------------------
[2020-05-25 06:40:40] thedinosaurmail at gmail dot com
the same problem with it
https://bugs.php.net/bug.php?id=76982
------------------------------------------------------------------------
[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