@@ -91,11 +91,7 @@ class ChannelResource : public FairMQMemoryResource
9191 void * do_allocate (std::size_t bytes, std::size_t alignment) override
9292 {
9393 FairMQMessagePtr message;
94- if (!factory) {
95- throw std::bad_alloc ();
96- } else {
97- message = factory->CreateMessage (bytes);
98- }
94+ message = factory->CreateMessage (bytes);
9995 void * addr = message->GetData ();
10096 messageMap[addr] = std::move (message);
10197 return addr;
@@ -141,12 +137,12 @@ class SpectatorAllocator : public boost::container::pmr::polymorphic_allocator<T
141137 void destroy (U*...){};
142138};
143139
144- using FastSpectatorAllocator = SpectatorAllocator<byte>;
145- using PMRAllocator = boost::container::pmr::polymorphic_allocator<byte>;
140+ using ByteSpectatorAllocator = SpectatorAllocator<byte>;
141+ using BytePmrAllocator = boost::container::pmr::polymorphic_allocator<byte>;
146142
147143// __________________________________________________________________________________________________
148144// / This memory resource only watches, does not allocate/deallocate anything.
149- // / In combination with the FastSpectatorAllocator this is an alternative to using span, as raw memory
145+ // / In combination with the ByteSpectatorAllocator this is an alternative to using span, as raw memory
150146// / (e.g. an existing buffer message) will be accessible with appropriate container.
151147class SpectatorMessageResource : public FairMQMemoryResource
152148{
@@ -224,7 +220,7 @@ template <typename ElemT>
224220auto adoptVector (size_t nelem, FairMQMessage* message)
225221{
226222 using namespace o2 ::memoryResources;
227- using DataType = std::vector<ElemT, FastSpectatorAllocator >;
223+ using DataType = std::vector<ElemT, ByteSpectatorAllocator >;
228224
229225 struct doubleDeleter {
230226 // kids: don't do this at home! (but here it's OK)
@@ -236,7 +232,7 @@ auto adoptVector(size_t nelem, FairMQMessage* message)
236232 using OutputType = std::unique_ptr<const DataType, doubleDeleter>;
237233
238234 auto resource = std::make_unique<SpectatorMessageResource>(message);
239- auto output = new DataType (nelem, FastSpectatorAllocator { resource.get () });
235+ auto output = new DataType (nelem, ByteSpectatorAllocator { resource.get () });
240236 return OutputType (output, doubleDeleter{ std::move (resource) });
241237}
242238
0 commit comments