[docs] [issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted
Pablo Galindo Salgado
report at bugs.python.org
Mon Dec 3 18:11:42 EST 2018
Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:
> I disagree that a child should keep its parent alive.
But this is normal across the standard library. For example, here is how a deque iterator keeps the deque alive:
>>> x = deque([1,2,3])
>>> deque_iter = iter(x)
>>> deque_weakref = weakref.ref(x)
>>> del x
>>> gc.collect()
>>> gc.get_referrers(deque_weakref())
[<_collections._deque_iterator object at 0x0000024447ED6EA8>]
Here, the deque iterator is the *only* reference to the deque. When we destroy it, the deque is destroyed:
>>> del deque_iter
>>> gc.collect()
>>> deque_weakref()
None
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34172>
_______________________________________
More information about the docs
mailing list