Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.67k stars 149 forks source link

Memory continue to grow while reading large file #41

Open Jeffwhen opened 6 years ago

Jeffwhen commented 6 years ago
async with aiofiles.open(fileName) as f:
    i = 0
    async for line in f:
        i += 1
        print(i, len(line))

Memory usage grows like there's no tomorrow.

Using explicit executor and close it after every usage seems to solve this problem. But I don't know why it works. What happens to those run_in_executor coroutine data?