[zeromq-dev] question about message buffer

Mohit Jaggi mohitjaggi at gmail.com
Mon Mar 11 08:04:56 CET 2013

Hmm...but messages are not sent in the context(I don't mean zmq context
here) of the calling thread, right? So, how can one use stack variable for
message object?

On Sun, Mar 10, 2013 at 11:08 PM, Pieter Hintjens <ph at imatix.com> wrote:

> On Mon, Mar 11, 2013 at 12:39 AM, Mohit Jaggi <mohitjaggi at gmail.com>
> wrote:
> > I understand, but the caller does not control if the message is stored in
> > VSM or on heap(since choice is made inside zmq code). So zmq has to
> somehow
> > copy the VSM before the message variable goes out of scope. Just want to
> > confirm that zmq does that.
> > Or is it not OK to use zmq_msg_t on stack and it should always be
> allocated
> > on heap?
> You're over-thinking it. The VSM data is just a property of zmq_msg_t
> like size and has the same scope / lifetime as the message object.
> You can use either stack or heap depending on your use case.
> -Pieter
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130311/dc1fda80/attachment.htm>

More information about the zeromq-dev mailing list