[zeromq-dev] [PATCH] reduce memory allocations in yqueue

Steven McCoy steven.mccoy at miru.hk
Thu Feb 4 09:36:46 CET 2010

On 4 February 2010 16:28, Martin Sustrik <sustrik at 250bpm.com> wrote:

> yqueue is not a cyclical buffer. Instead it allocates chunks on the writer
> side and decallocates them on the reader side. Thus, however large the
> chunk, it's still going to be allocated/deallocated every now and then.
> What Joe did is optimising the mechanism of handing the used chunks from
> the reader thread back to the writer thread. Instead of free/malloc pair
> single chunk can be moved using atomic ops. Interestingly, this mechanism is
> used exclusively (i.e. no malloc/free altogether) when the system is not
> fully loaded and messages are just passing through the queue.
In effect the spare chunk turns it into a cyclic buffer when the queue size
is less than N, wrapping between the two chunks.  Ok, I didn't read the pop

Thanks for the explanation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100204/d9e95cc8/attachment.htm>

More information about the zeromq-dev mailing list