[issue41699] Potential memory leak with asyncio and run_in_executor
Sophia Wisdom
report at bugs.python.org
Thu Oct 29 16:53:21 EDT 2020
Sophia Wisdom <sophia at reduct.video> added the comment:
It looks like it's not specific to the ThreadPoolExecutor.
```
import asyncio
import concurrent
def leaker_func():
list(range(int(1000)))
# removed 1/0 because this causes issues with the ProcessPoolExecutor
async def function():
loop = asyncio.get_running_loop()
for i in range(10000):
loop.run_in_executor(concurrent.futures.ProcessPoolExecutor(), leaker_func)
```
10MB at this point
then after executing this:
```
asyncio.run(function())
```
40MB. (~same as ThreadPoolExecutor in python3.10)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41699>
_______________________________________
More information about the Python-bugs-list
mailing list