qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Hartline <andrewhartl...@gmail.com>
Subject qpid-cpp: bad_allocs when using "empty" Message constructor within Boost test framework
Date Tue, 08 Sep 2015 21:48:04 GMT
Hi qpid users,

I have an interesting issue. In the qpid-cpp examples the following idiom
works to create a Message object on the stack.

        Message m;

This looks like it should be calling an empty constructor but in fact no
such constructor is defined. Instead it's calling this one:

        Message
<https://qpid.apache.org/releases/qpid-0.28/messaging-api/cpp/api/classqpid_1_1messaging_1_1Message.html#a10ceff23ff6fde62d9026fd13bc28662>
(const
std::string &bytes=std::string())

Creating a Message in this way works fine for me in the qpid-cpp examples,
but it throws a std::bad_alloc when I do it from within the Boost test
framework. I hypothesize that it has something to do with the construction
of the defaulted string, but don't know what the details could be.

If from inside the Boost framework,  I create a Message like so:

        qpid::types::Variant v(123);
        qpid::messaging::Message msg(v);

there is no bad_alloc.

Throwing in this dummy Variant is ok as a workaround, but I would love to
know what's going on under the hood. Does anyone have any idea why I might
be getting these bad_allocs?

Thanks,

Andrew

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message