Open alanxz opened 7 years ago
Just so everyone knows, this doesn't mean there is a leak in the listener within the loop, and that the program will crash, it just means that the example listener program leaks the queue name (just a few bytes), this does not cause an error in normal operation:
however, if someone wants to not even have that, I tried to fix it this way:
becomes this: amqp_bytes_t qn = amqp_cstring_bytes(queuename); amqp_basic_consume(conn, 1, qn, amqp_empty_bytes, 0, 0, 0, amqp_empty_table);
and at the end of main, before the
return 0,
add this: amqp_bytes_free(qn); return 0;
Anybody that knows more C++ than I do, feel free to correct my mistakes.
after seeing how the memory usage increased on XCode, I assumed this meant this was a problem, turns out I was wrong.
I hope this saves people time.
From the mailing list: https://groups.google.com/forum/#!topic/rabbitmq-c-users/x6ivLTl0rt4
I would just like to inform you about a (very little) memory leak in the Listen sample (and maybe in others).
It misses a
amqp_bytes_free(queuename)
to release the memory allocated byqueuename = amqp_bytes_malloc_dup(r->queue);