41 #include <uavcan/uavcan.hpp> 42 #include <uavcan/helpers/heap_based_pool_allocator.hpp> 49 const ::irqstate_t
state = ::enter_critical_section();
53 struct Allocator :
public uavcan::HeapBasedPoolAllocator<uavcan::MemPoolBlockSize, AllocatorSynchronizer> {
54 static constexpr
unsigned CapacitySoftLimit = 250;
55 static constexpr
unsigned CapacityHardLimit = 500;
58 uavcan::HeapBasedPoolAllocator<uavcan::MemPoolBlockSize,
AllocatorSynchronizer>(CapacitySoftLimit, CapacityHardLimit)
63 if (getNumAllocatedBlocks() > 0) {
64 PX4_ERR(
"UAVCAN LEAKS MEMORY: %u BLOCKS (%u BYTES) LOST",
65 getNumAllocatedBlocks(), getNumAllocatedBlocks() * uavcan::MemPoolBlockSize);
Simple error/warning functions, heavily inspired by the BSD functions of the same names...