activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: ActiveMQ CPP: Getting text from a Text Message without making temporary
Date Mon, 13 Feb 2012 22:43:32 GMT
On Mon, 2012-02-13 at 14:26 -0800, stephenju wrote: 
> Just went through the source files and find it actually makes 4 copies of the
> text.
> MarshallingSupport::readString32() makes 1 from the stream.
> ActiveMQTextMessage::getText() then make another one to store in its data
> member. Then it makes yet another one as return value. Finally, the
> assignment in my code makes one for itself.
> Maybe I count them wrong? :)
C++ String object uses a reference counted design so the copies are
lightweight copies internally they all point to the same data until a
mutating operation is performed.  Most modern compilers will also
optimize the return by using RVO and NRVO to eliminate the use of a

> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

Tim Bish
Sr Software Engineer | FuseSource Corp |
skype: tabish121 | twitter: @tabish121

View raw message