mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 18:22:32 +00:00
Static memory pool allocation (#7966)
* Static memory pool * Initializer * T-Lora Pager: Support LR1121 and SX1280 models (#7956) * T-Lora Pager: Support LR1121 and SX1280 models * Remove ifdefs --------- Co-authored-by: WillyJL <me@willyjl.dev>
This commit is contained in:
@@ -115,12 +115,11 @@ template <class T, int MaxSize> class MemoryPool : public Allocator<T>
|
||||
bool used[MaxSize];
|
||||
|
||||
public:
|
||||
MemoryPool()
|
||||
MemoryPool() : pool{}, used{}
|
||||
{
|
||||
// Initialize the used array to false (all slots free)
|
||||
for (int i = 0; i < MaxSize; i++) {
|
||||
used[i] = false;
|
||||
}
|
||||
// Arrays are now zero-initialized by member initializer list
|
||||
// pool array: all elements are default-constructed (zero for POD types)
|
||||
// used array: all elements are false (zero-initialized)
|
||||
}
|
||||
|
||||
/// Return a buffer for use by others
|
||||
|
||||
Reference in New Issue
Block a user