[issue41699] Potential memory leak with asyncio and run_in_executor

2020-10-29 Thread Sophia Wisdom
Sophia Wisdom added the comment: While not calling executor.shutdown() may leave some resources still used, it should be small and fixed. Regularly calling executor.shutdown() and then instantiating a new ThreadPoolExecutor in order to run an asyncio program does not seem like a good API to

[issue41699] Potential memory leak with asyncio and run_in_executor

2020-10-29 Thread Sophia Wisdom
Sophia Wisdom 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():

[issue41699] Potential memory leak with asyncio and run_in_executor

2020-09-02 Thread Sophia Wisdom
New submission from Sophia Wisdom : The below example leaks ~20 megabytes of memory. The amount leaked is related to both the number of items in the list and the number of times `run_in_executor` is called. ``` import asyncio def leaker(): x = list(range(int(1000))) 1/0 async def