great...that is what I was trying to confirm :-) Thanks Pieter! " So zmq has to somehow copy the VSM before the message variable goes out of scope. Just want to confirm that zmq does that."
On Mon, Mar 11, 2013 at 2:13 AM, Pieter Hintjens <p...@imatix.com> wrote: > Very small messages (under 30 bytes at present) are copied around > rather than referenced. > > -Pieter > > On Mon, Mar 11, 2013 at 8:04 AM, Mohit Jaggi <mohitja...@gmail.com> wrote: > > 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 <p...@imatix.com> wrote: > >> > >> On Mon, Mar 11, 2013 at 12:39 AM, Mohit Jaggi <mohitja...@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@lists.zeromq.org > >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > > > > > > _______________________________________________ > > zeromq-dev mailing list > > zeromq-dev@lists.zeromq.org > > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev >
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev