[zeromq-dev] zmq_msg_init_data with zero deallocation function
ph at imatix.com
Wed May 11 18:23:53 CEST 2011
2011/5/11 Ilja Golshtein <ilejncs at narod.ru>:
> In zguide the zmq_msg_init_data syntax with zero ffn is used a couple of times, though I failed to find if it is explained
> why it is wrong or at least dangerous.
I removed all these examples from the guide because they were very
misleading. The _init_data method should only be used when you really
need zero copy. The name is too similar to init_size and suggests it's
easy and safe to use. Really, it's quite tricky until you figure it
In the guide examples it was being used with constant message bodies
("HELLO"). In reality you would always pass a ffn, and never use this
for stack-based data, since the stack can often unroll before the
message is actually sent.
I'd like to rename this method 'zmq_msg_init_zero_copy_for_experts_only' :)
More information about the zeromq-dev