[zeromq-dev] Memory pool for zmq_msg_t

Francesco francesco.montorsi at gmail.com
Thu Jul 4 14:21:21 CEST 2019

Hi all,

I'm doing some benchmarking of a library I wrote based on ZMQ.
In most of my use cases if I do a "perf top" on my application thread I see
something like this:

  12,09%  [kernel]              [k] sysret_check
   7,48%  [kernel]              [k] system_call_after_swapgs
   5,64%  libc-2.25.so          [.] _int_malloc
   3,40%  libzmq.so.5.2.1       [.] zmq::socket_base_t::send
   3,20%  [kernel]              [k] do_sys_poll

That is, ignoring the calls to Linux kernel, I see that malloc() is the
most time-consuming operation my software is doing. After some
investigation that's due to the use I do of zmq_msg_init_size().

Now I wonder: somebody has ever tried to avoid this kind of malloc() by
using the zmq_msg_init_data() API instead and some sort of memory pool for
zmq_msg_t objects?

I've seen some proposal in this email thread:

but as far as I know nothing was submitted to the zmq community, right?

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

More information about the zeromq-dev mailing list