|
20 | 20 |
|
21 | 21 | #include "rcl/types.h"
|
22 | 22 |
|
23 |
| -#include "rclcpp/allocator/allocator_common.hpp" |
| 23 | +#include "rcl/allocator.h" |
24 | 24 | #include "rclcpp/exceptions.hpp"
|
25 | 25 | #include "rclcpp/macros.hpp"
|
26 | 26 | #include "rclcpp/serialized_message.hpp"
|
@@ -61,15 +61,19 @@ class MessageMemoryStrategy
|
61 | 61 | message_allocator_ = std::make_shared<MessageAlloc>();
|
62 | 62 | serialized_message_allocator_ = std::make_shared<SerializedMessageAlloc>();
|
63 | 63 | buffer_allocator_ = std::make_shared<BufferAlloc>();
|
64 |
| - rcutils_allocator_ = allocator::get_rcl_allocator<char, BufferAlloc>(*buffer_allocator_.get()); |
| 64 | + // The rcl allocator interface is incompatible with C++ allocators |
| 65 | + static_assert(std::is_same<Alloc, std::allocator<void>>::value, "Non-default allocators are not supported"); |
| 66 | + rcutils_allocator_ = rcl_get_default_allocator(); |
65 | 67 | }
|
66 | 68 |
|
67 | 69 | explicit MessageMemoryStrategy(std::shared_ptr<Alloc> allocator)
|
68 | 70 | {
|
69 | 71 | message_allocator_ = std::make_shared<MessageAlloc>(*allocator.get());
|
70 | 72 | serialized_message_allocator_ = std::make_shared<SerializedMessageAlloc>(*allocator.get());
|
71 | 73 | buffer_allocator_ = std::make_shared<BufferAlloc>(*allocator.get());
|
72 |
| - rcutils_allocator_ = allocator::get_rcl_allocator<char, BufferAlloc>(*buffer_allocator_.get()); |
| 74 | + // The rcl allocator interface is incompatible with C++ allocators |
| 75 | + static_assert(std::is_same<Alloc, std::allocator<void>>::value, "Non-default allocators are not supported"); |
| 76 | + rcutils_allocator_ = rcl_get_default_allocator(); |
73 | 77 | }
|
74 | 78 |
|
75 | 79 | virtual ~MessageMemoryStrategy() = default;
|
|
0 commit comments