php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74640 Generators can leak memory
Submitted: 2017-05-23 15:47 UTC Modified: 2017-10-16 06:28 UTC
From: g dot aivaras at gmail dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 7.1.5 OS: MacOS 10.12.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: g dot aivaras at gmail dot com
New email:
PHP Version: OS:

 

 [2017-05-23 15:47 UTC] g dot aivaras at gmail dot com
Description:
------------
When iterating over generators sometimes yielded objects have extra references somewhere. I tried to simplify the test case as much has possible but almost same code in single file did not had this problem

Test script:
---------------
https://github.com/GrandLTU/GeneratorTest

Expected result:
----------------
$ php bin/test.php
Object created 
Object created
Object destroyed 
Object destroyed 
int(0)
int(0)
Exit

Actual result:
--------------
$ php bin/test.php
Object created 
Object created 
int(2)
int(2)
Exit
Object destroyed 
Object destroyed

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-12 00:15 UTC] ajf@php.net
This is quite a complicated test case. Does it need to be this many files?

Also, can you provide the “almost same code in single file”?
 [2017-10-16 06:28 UTC] g dot aivaras at gmail dot com
-Status: Open +Status: Closed
 [2017-10-16 06:28 UTC] g dot aivaras at gmail dot com
Not a bug, after looking over with fresh mind I saw that this is code issue.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 04:00:02 2026 UTC