[rabbitmq-discuss] rabbitmq-c memory leak?

Alan Antonuk alan.antonuk at gmail.com
Thu Apr 10 06:11:19 BST 2014


What version of SimpleAmqpClient are you using? The lines surrounding your
change don't seem to match what is
currently<https://github.com/alanxz/SimpleAmqpClient/blob/master/src/ChannelImpl.cpp#L153>in
the master branch of SimpleAmqpClient. I believe behavior you're
seeing
was addressed a while ago (see Issue
#56<https://github.com/alanxz/SimpleAmqpClient/issues/56>).
Please download the master branch and build from that, you will also need
rabbitmq-c v0.4.1 or newer for this to work.

FYI: the patch you are suggesting using will likely cause undefined
behavior. Because of the way rabbitmq-c's memory management works, the
SimpleAmqpClient cannot call amqp_maybe_release_buffers() until it no
longer holds any references to frames returned from
amqp_simple_wait_frame(). Once amqp_maybe_release_buffers() (or
amqp_maybe_release_buffers_on_channel()) any outstanding frames are
considered freed and their use will lead to undefined behavior.
SimpleAmqpClient maintains a list of frames that it has seen from the
broker, in ChannelImpl::MaybeReleaseBuffersOnChannel<https://github.com/alanxz/SimpleAmqpClient/blob/master/src/ChannelImpl.cpp#L446>
it
checks to see if there are any frames that it still has a reference to
before calling amqp_maybe_release_buffers()

-Alan


On Wed, Apr 9, 2014 at 3:17 PM, Dushin Fred <fred at dushin.net> wrote:

> That works for me, too.  Thanks, Abhay.
>
> Alan, would you like a pull request?  Is there a timeline for folding this
> an the other recent fixes into master?  Anything I can do to help expedite?
>
> -Fred
>
> On Apr 9, 2014, at 4:54 AM, Abhay Rajure <arajure at gmail.com> wrote:
>
> Try this --
>
> In File SimpleAmqpClient/src/ChannelImpl.cpp,
> call amqp_maybe_release_buffers_on_channel() in ReturnChannel().
>
> void ChannelImpl::ReturnChannel(amqp_chanel_t channel)
> {
>   +amqp_maybe_release_buffers_on_channel(m_connection, channel);
>    m_free_channels.push(channel);
> }
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140409/4ac20cc6/attachment.html>


More information about the rabbitmq-discuss mailing list