In PyPy3, when an iterator is closed with "close()" method, the iterator leaks and cannot be collected.
 
Execute the following script in PyPy3, the memory usage is increasing very fast, and gc.collect() cannot collect the memory
 
 
def test():
    yield 1
 
while True:
    t = test()
    t.close()
 
 
The tested version:
 
Python 3.5.3 (fdd60ed87e94, Apr 24 2018, 06:10:04)
[PyPy 6.0.0 with GCC 6.2.0 20160901]
 
This is not reproduced in CPython 3.5 and PyPy2.
 
2018-06-28

hubo