New submission from Peter Würtz <pwue...@gmail.com>:

Itertools `tee` does not seem to de-reference yielded items, even after 
consumption of all items from all tee-iterators.

According to the documentation (to my understanding), there shouldn't be any 
extra memory requirement as long as the tee-iterators are consumed in a 
balanced way. I.e. after an item was pulled from all iterators there shouldn't 
be any residual reference to it.

This is true for the example-implementation mentioned in the documentation, but 
`itertools.tee` doesn't de-reference items until the tee-iterator itself is 
deleted:

https://pastebin.com/r3JUkH41

Is this a bug or am I missing something?

----------
components: Library (Lib)
messages: 364849
nosy: pwuertz
priority: normal
severity: normal
status: open
title: itertools.tee does not release resources during iteration?
type: resource usage
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40047>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to