[zeromq-dev] question about message buffer

Pieter Hintjens ph at imatix.com
Mon Mar 11 07:08:28 CET 2013

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.


More information about the zeromq-dev mailing list