librabbitmq icon indicating copy to clipboard operation
librabbitmq copied to clipboard

Memory Leak - Basic Publish

Open bafitor opened this issue 7 years ago • 0 comments

Hey guys,

I'm seeing a memory leak when using the 2.0.0 version of the library. Each call to basic_publish is increasing the memory consumption.

You can check the code below that easily triggers the issue. I'm seeing this behaviour on Ubuntu and OS X.

Details: Python: 3.6.6 RabbitMQ: 3.7.6 Erlang: 20.3.5

Code:

    from librabbitmq import Connection, Message

    with Connection(host=HOST, port=PORT, userid=USERNAME, password=PASSWORD, virtual_host="/") as conn:
        with conn.channel() as channel:
            channel.exchange_declare(exchange='re', type='direct', auto_delete=False)

            data = json.dumps({
                'some_key': 'some_value'
            })

            message = Message(channel=channel, properties={}, body=data)

            while True:
                channel.basic_publish(message, 're', routing_key='')

I used the same code with amqp library and there wasn't any issue.

Can someone help figure this out?

Thanks

bafitor avatar Aug 10 '18 15:08 bafitor