'Why do my asyncio network streams cause memory leaks on disconnect?
I am currently trying to create an IRC client for personal uses. My problem is the handling of connection losses. To test this I created a small test program that emulates constant reconnects:
import asyncio
async def connect():
while True:
try:
# never actually opens a connection
reader, writer = await asyncio.open_connection("notahost", 1)
except OSError as e:
pass
asyncio.run(connect())
The issue that I found with this is that on every reconnect the memory usage of the process rises, why is that? I've tried closing the writer afterwards but that results in an error because it is already dead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
