[zeromq-dev] C++ Move Constructor and Assignment Operator
Richard_Newton at waters.com
Richard_Newton at waters.com
Thu Feb 14 10:55:16 CET 2013
I would presume it does it so it can avoid allocating on the heap for small messages.
If your message is < 30 bytes then it is stored within message_t, i.e. on the stack if message_t is on the stack, >= 30 bytes it mallocs some memory
(buffer size + sizeof(content_t) for some reference counting housekeeping).
Richard.
From: "Christoph Heindl" <christoph.heindl at gmail.com>
To: "ZeroMQ development list" <zeromq-dev at lists.zeromq.org>
Date: 14/02/2013 09:43 AM
Subject: Re: [zeromq-dev] C++ Move Constructor and Assignment Operator
Sent by: zeromq-dev-bounces at lists.zeromq.org
Hi Richard,
On Thu, Feb 14, 2013 at 10:14 AM, <Richard_Newton at waters.com> wrote:
I believe zeromq does this is by design. It copies the data if the message size is small and reference counts it if its above a certain size.
Ok, I did not know that. Would by interesting to know why. Is ZMQ using some kind of small buffer optimization, where it uses the first few bytes of
the buffer for reference counter or storing the values if small enough?
It looks like the size threshold is specified by the max_vsm_size enum in msg.hpp, currently set to 29, so if you make your message size 30 it
should switch to reference counting.
I did and it works. Added both, positive and negative tests.
Thanks for the hint.
Best,
Christoph_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
===========================================================
The information in this email is confidential, and is intended solely for the addressee(s).
Access to this email by anyone else is unauthorized and therefore prohibited. If you are
not the intended recipient you are notified that disclosing, copying, distributing or taking
any action in reliance on the contents of this information is strictly prohibited and may be unlawful.
===========================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130214/f4dbf9e0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130214/f4dbf9e0/attachment.gif>
More information about the zeromq-dev
mailing list