-
-
Notifications
You must be signed in to change notification settings - Fork 569
Open
Labels
Description
Hello, I've tested multiple websockets libraries in python to create clients. However each time I create websocket client it allocates ~1.5MB of memory. Is this behaviour expected?
Running this code bumps memory from ~50MB to ~65MB on my machine (as I inspect task manager).
import websockets
async def main():
async def startWebsocket():
async with websockets.connect("wss://echo.websocket.org") as ws:
await asyncio.sleep(99999999)
tasks = []
for _ in range(10):
tasks.append(startWebsocket())
await asyncio.gather(*tasks)
asyncio.run(main())
This code keeps memory usage at ~50MB:
import websockets
async def main():
await asyncio.sleep(99999)
asyncio.run(main())