Re: [zeromq-dev] question about message buffer

2013-03-11 Thread Mohit Jaggi
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 wrote: > Very small messages (under 30 bytes at present)

Re: [zeromq-dev] question about message buffer

2013-03-11 Thread Pieter Hintjens
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 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

Re: [zeromq-dev] question about message buffer

2013-03-11 Thread Mohit Jaggi
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 wrote: > On Mon, Mar 11, 2013 at 12:39 AM, Mohit Jaggi > wrote: > > > I understan

Re: [zeromq-dev] question about message buffer

2013-03-10 Thread Pieter Hintjens
On Mon, Mar 11, 2013 at 12:39 AM, Mohit Jaggi 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

Re: [zeromq-dev] question about message buffer

2013-03-10 Thread Mohit Jaggi
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

Re: [zeromq-dev] question about message buffer

2013-03-06 Thread Pieter Hintjens
On Thu, Mar 7, 2013 at 2:46 AM, Mohit Jaggi wrote: > still trying to get to the bottom of this..appreciate any help. Especially > want to know how the VSM data is handled. The VSM data is a block of memory inside the zmq_msg_t structure, so usually allocated on the stack. -Pieter __

Re: [zeromq-dev] question about message buffer

2013-03-06 Thread Mohit Jaggi
still trying to get to the bottom of this..appreciate any help. Especially want to know how the VSM data is handled. On Mon, Mar 4, 2013 at 10:59 AM, Mohit Jaggi wrote: > This is not fully full but more detailed...'buf' is on stack (so > destructor will be called) and 'm' is on heap(and I havn'

Re: [zeromq-dev] question about message buffer

2013-03-04 Thread Mohit Jaggi
This is not fully full but more detailed...'buf' is on stack (so destructor will be called) and 'm' is on heap(and I havn't called delete...should I?). I want to understand how zmq treats them. context_t ctx(1); socket_t *publisher; void init() { publisher = new socket publisher.bind(...)

Re: [zeromq-dev] question about message buffer

2013-03-04 Thread Pieter Hintjens
Hi Mohit, Can you provide a full example? -Pieter On Mon, Mar 4, 2013 at 8:34 AM, Mohit Jaggi wrote: > Hi, > I am a little confused about how messages and buffers are handled in zmq. In > the following example, valgrind finds a message leak for 'm'. > 1) Should I call delete for 'm' after the

[zeromq-dev] question about message buffer

2013-03-03 Thread Mohit Jaggi
Hi, I am a little confused about how messages and buffers are handled in zmq. In the following example, valgrind finds a message leak for 'm'. 1) Should I call delete for 'm' after the send? 2) zmq will keep the buffer(data) but free memory for 'm' if I do this? 3) What about 'topic'? It is on stac