php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79626 arrow fucntion memory leak
Submitted: 2020-05-25 06:35 UTC Modified: 2020-05-25 07:04 UTC
From: thedinosaurmail at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.4.6 OS: ubuntu 16.
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thedinosaurmail at gmail dot com
New email:
PHP Version: OS:

 

 [2020-05-25 06:35 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-05-25 06:40 UTC] thedinosaurmail at gmail dot com
-Summary: memory leak +Summary: arrow fucntion memory leak
 [2020-05-25 06:40 UTC] thedinosaurmail at gmail dot com
the same problem with it 
https://bugs.php.net/bug.php?id=76982
 [2020-05-25 07:04 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Package: *General Issues +Package: Scripting Engine problem -Assigned To: +Assigned To: cmb
 [2020-05-25 07:04 UTC] cmb@php.net
Indeed, duplicate of bug #76982.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 08:01:28 2024 UTC