New submission from Vytautas Liuolia <vytautas.liuo...@gmail.com>:

Hello!
I am having issues with asynchronous generators not being garbage collected at 
least until the current loop has completed.

In the attached test case (test.py), one starts iterating over an asynchronous 
generator, then breaks and returns the first element. After each call, 
gc.collect() is invoked for illustration purposes.
It seems that no memory is freed until the whole test() coroutine is done.

The for-loop could obviously be extended to more iterations, or swapped out to 
a while-loop to easily run out of available memory.

I have then removed all async stuff, producing test_sync.py (also attached). In 
the sync case, everything is garbage-collected as I would expect.

----------
components: asyncio
files: test.py
messages: 371550
nosy: asvetlov, vytas, yselivanov
priority: normal
severity: normal
status: open
title: Async generators are not garbage collected
type: resource usage
versions: Python 3.8
Added file: https://bugs.python.org/file49231/test.py

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

Reply via email to