<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>I have written a simple test program using the SimpleAqmpClient library (which in turn uses the rabbitmq-c library), which seems to illustrate a memory leak, of sorts.</div><div><br></div><div>The program is a simple main, which pre-allocates a string message, and then calls BasicPublish on a channel in a loop, all single threaded. Effectively:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> <span style="color: #bb2ca2">auto</span> envelope = <span style="color: #703daa">BasicMessage</span>::<span style="color: #3d1d81">Create</span>(<span style="color: #31595d">random_data</span>(message_size));</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> <span style="color: #bb2ca2">for</span> (<span style="color: #bb2ca2">unsigned</span> i = <span style="color: #272ad8">0</span>; i < num_messages; ++i)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> channel-><span style="color: #3d1d81">BasicPublish</span>(exchange_name, routing_key, envelope);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> }</div></div><div><br></div><div>The problem is that the memory image of this process seems to grow without bounds. The memory all seems to be allocated in amqp_pool_alloc (as expected), when calling wait_frame_inner -> amqp_handle_input. The memory is not orphaned -- i.e., it seems to get cleaned up at shutdown, so it doesn't show up as a leak in a leak detector tool, such a Instruments/DTrace, or valgrind, or purify, etc. But I don't see where the memory is every de-allocated, which will spell doom for an application that is designed to never terminate.</div><div><br></div><div>I am attaching a screenshot from an Instruments run, to give some context. The code is here:</div><div><br></div><div><a href="https://github.com/fadushin/sandbox/blob/master/cpp/rabbitmq/sender.cpp">https://github.com/fadushin/sandbox/blob/master/cpp/rabbitmq/sender.cpp</a></div><div><br></div><div>This was run against RabbitMQ 3.2.4, using rabbitmq-c 0.5.0 and SimpleAmqpClient 2.3, compiled using Clang 5.0 on OS X.9 (Mavericks).</div><div><br></div><div>Has anyone seen this behavior? Am I missing something in my use of BasicPublish, that is not telling the rabbitmq-c library to free memory in the "amqp pool"? It doesn't seem to make a difference whether I am actively pulling messages off the queue from a separate process, or even whether there is a queue bound to the exchange to which I am publishing messages. (Not that I would expect it to)</div><div><br></div><div>-Fred</div><div><br></div><div>encl.</div><div><br></div><div><br></div><div><img apple-inline="yes" id="E5B9E917-F251-45D5-A41F-D0AD0D131613" height="545" width="897" apple-width="yes" apple-height="yes" src="cid:9DBB6641-0A1A-4374-9788-CFF34265600A@corp.emc.com"></div></body></html>