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

Martin Sustrik sustrik at 250bpm.com
Wed Feb 3 17:05:49 CET 2010


Joe,

> It reduces memory allocation in yqueue by holding onto one unused
> chunk rather than handing it back to the global new/delete allocators.
>  For the common case where messages are being produced at a similar
> rate to consumption this is a big win.

Some time ago we've tried to minimise number of allocations per message. 
We've ended with one malloc/free pair per 256 messages (small messages 
that can be kept on the stack).

This patch gives it the final polish.

There are NO allocations needed to pass messages.

Cute!

I'll check it in shortly.

Martin



More information about the zeromq-dev mailing list