[zeromq-dev] Zero-copy message API
Jon Dyte
jon at totient.co.uk
Sun Apr 3 11:41:02 CEST 2011
Pieter Hintjens wrote:
> Hi Martin,
>
> One thing that seems to consistently trip up users is the zero-copy
> message API, and the way it's presented. That is, reading the docs,
> there's no hint that zmq_msg_init_data() is much harder to use
> properly than zmq_msg_init_size().
>
> For the 3.0 API, it could be neat to slice these apart and make it
> clearer that there is a simple way for 90% of apps, and a complex way
> for 10%.
>
> For example, zmq_msg_init() might take a size argument, and merge the
> functionality of zmq_msg_init_size(), and then we could rename
> init_data to zmq_msg_init_zerocopy().
>
> -Pieter
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
+1 on clarity in this area.
There was some example recently where zmq_msg_init_data was being used
with a stack based buffer
and a null freefn which was ok for the example as it was a REQ socket
with a very simple loop.
But it's not immediately clear that if you change to say an XREQ and
zmq_poll and start doing multiple sends
bad-things-will-happen.
It can be argued that it was just a bad example prog, but I think people
could (and are) finding these examples
and cut'n'pasting the code and if it crashes it makes 0MQ look bad.
Jon
More information about the zeromq-dev
mailing list