[zeromq-dev] Very Small Messages/Manual

Martin Sustrik sustrik at 250bpm.com
Tue Jul 27 12:37:05 CEST 2010


Ben Kloosterman wrote:

>  >Agreed, but there's no way to set the MAX_VSM_SIZE at runtime. Compiler
>  >has to be aware of it.
> 
> True , but I bet changing it is not tested either  . 
> 
> This is more of an architecture decision  , instead of fixed size we could
> just assume the message is flexible and get the pipe to allocate the memory
> and just place the struct at the header. Instead of incrementing it by a
> constant message size you bump up the counter by the size in the message.

Think of this:

     zmq_msg_t msg;
     zmq_msg_init_size (&msg, 5);
     memcpy (zmq_msg_data (&msg), 5, "ABCDE");
     ...

Here the _compiler_ allocates the storage for the data on the stack. The 
size of the structure has to be fixed otherwise compiler won't know how 
to adjust the stack pointer.

Martin



More information about the zeromq-dev mailing list