From 9b092509c93794ec60484b2864be7a2995aefac6 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Sat, 17 Oct 2015 00:45:04 +0300 Subject: [PATCH] TestNode uses heap based allocator now --- libuavcan/test/node/test_node.hpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libuavcan/test/node/test_node.hpp b/libuavcan/test/node/test_node.hpp index bd71b89ee3..8032d06419 100644 --- a/libuavcan/test/node/test_node.hpp +++ b/libuavcan/test/node/test_node.hpp @@ -10,6 +10,7 @@ #endif #include +#include #include #include #include @@ -19,13 +20,20 @@ struct TestNode : public uavcan::INode { - uavcan::PoolAllocator pool; + /* + * This class used to use the simple pool allocator instead: + * uavcan::PoolAllocator pool; + * It has been replaced because unlike the simple allocator, heap-based one is not tested as extensively. + * Moreover, heap based allocator prints and error message upon destruction if some memory has not been freed. + */ + uavcan::HeapBasedPoolAllocator pool; uavcan::Scheduler scheduler; uint64_t internal_failure_count; - TestNode(uavcan::ICanDriver& can_driver, uavcan::ISystemClock& clock_driver, uavcan::NodeID self_node_id) - : scheduler(can_driver, pool, clock_driver) - , internal_failure_count(0) + TestNode(uavcan::ICanDriver& can_driver, uavcan::ISystemClock& clock_driver, uavcan::NodeID self_node_id) : + pool(1024), + scheduler(can_driver, pool, clock_driver), + internal_failure_count(0) { setNodeID(self_node_id); }