php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69887 yield leaks temporary variables when Generator is aborted
Submitted: 2015-06-19 21:34 UTC Modified: 2015-06-23 12:13 UTC
From: bwoebi@php.net Assigned: nikic (profile)
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.0Git-2015-06-19 (Git) OS: Irrelevant
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: bwoebi@php.net
New email:
PHP Version: OS:

 

 [2015-06-19 21:34 UTC] bwoebi@php.net
Description:
------------
Temporary variables of an aborted vm stack are never freed and thus leak...

Test script:
---------------
$gen = (function(){
    $tmp = 1;
    [$tmp] + yield; // temporary variable created, but never freed as it halts after yield
})();
$gen->valid(); // run until first yield

Expected result:
----------------
No memory leak

Actual result:
--------------
[Fri Jun 19 23:29:53 2015]  Script:  '/Users/Bob/Icicle/examples/repro2.php'
Zend/zend_vm_execute.h(35171) :  Freeing 0x103C5B480 (56 bytes), script=/Users/Bob/Icicle/examples/repro2.php
[Fri Jun 19 23:29:53 2015]  Script:  '/Users/Bob/Icicle/examples/repro2.php'
/Users/Bob/php-src-7.0x/Zend/zend_hash.c(128) :  Freeing 0x103C61B40 (264 bytes), script=/Users/Bob/Icicle/examples/repro2.php
=== Total 2 memory leaks detected ===


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-19 21:36 UTC] nikic@php.net
This is the same issue as https://bugs.php.net/bug.php?id=62210. There is no simple fix for it.
 [2015-06-20 06:14 UTC] laruence@php.net
-Assigned To: +Assigned To: nikic
 [2015-06-23 12:13 UTC] tyrael@php.net
-Status: Assigned +Status: Duplicate
 [2015-06-23 12:13 UTC] tyrael@php.net
we can use https://bugs.php.net/bug.php?id=62210 to track the status of this problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC