Description
Upon running the example code in examples\prompts\asyncio-prompt.py
, I noticed the memory usage climbed rapidly and consistently on my machine -- simply leaving the application sit without doing anything with it would have python.exe using a gigabyte or more of RAM in a few minutes. This was run on a Windows 10 machine running Python 3.8.1.
A bit of investigation later, it appears that the issue may be the underlying app.run_async
call is adding thousands of tasks to event loop during its execution. Modifying line 30 of the asyncio-prompt.py
example file from its current print
statement to print(f'Tasks: {len(asyncio.all_tasks())}')
shows that the number of active tasks in the event loop grows very quickly during execution:
This is only an issue with the current master branch version -- it does not occur in prompt-toolkit 3.0.2 from pip, but I figured the issue might still be of use to report.