Skip to content

High RAM memory usage #1644

@user895v

Description

@user895v

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())

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions