|  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: 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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2015-06-19 21:34 UTC]
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 ===


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-19 21:36 UTC]
This is the same issue as There is no simple fix for it.
 [2015-06-20 06:14 UTC]
-Assigned To: +Assigned To: nikic
 [2015-06-23 12:13 UTC]
-Status: Assigned +Status: Duplicate
 [2015-06-23 12:13 UTC]
we can use to track the status of this problem.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 21:01:27 2024 UTC