File tree 1 file changed +11
-6
lines changed
demo_nodes_cpp/src/topics
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 15
15
#include < chrono>
16
16
#include < list>
17
17
#include < memory>
18
+ #include < memory_resource>
18
19
#include < string>
19
20
#include < utility>
20
- #include < memory_resource>
21
21
22
22
#include " rclcpp/rclcpp.hpp"
23
23
#include " rclcpp/allocator/allocator_common.hpp"
@@ -30,24 +30,29 @@ using namespace std::chrono_literals;
30
30
static uint32_t num_allocs = 0 ;
31
31
static uint32_t num_deallocs = 0 ;
32
32
// A very simple custom memory resource. Counts calls to do_allocate and do_deallocate.
33
- class CustomMemoryResource : public std ::pmr::memory_resource {
33
+ class CustomMemoryResource : public std ::pmr::memory_resource
34
+ {
34
35
private:
35
- void * do_allocate (std::size_t bytes, std::size_t alignment) override {
36
+ void * do_allocate (std::size_t bytes, std::size_t alignment) override
37
+ {
36
38
num_allocs++;
37
39
(void )alignment;
38
40
return std::malloc (bytes);
39
41
}
40
42
41
- void do_deallocate (void * p, std::size_t bytes,
42
- std::size_t alignment) override {
43
+ void do_deallocate (
44
+ void * p, std::size_t bytes,
45
+ std::size_t alignment) override
46
+ {
43
47
num_deallocs++;
44
48
(void )bytes;
45
49
(void )alignment;
46
50
std::free (p);
47
51
}
48
52
49
53
bool do_is_equal (
50
- const std::pmr::memory_resource& other) const noexcept override {
54
+ const std::pmr::memory_resource & other) const noexcept override
55
+ {
51
56
return this == &other;
52
57
}
53
58
};
You can’t perform that action at this time.
0 commit comments