diff --git a/src/mesh/MemoryPool.h b/src/mesh/MemoryPool.h index 84cac7effc..d30404b9f0 100644 --- a/src/mesh/MemoryPool.h +++ b/src/mesh/MemoryPool.h @@ -73,58 +73,3 @@ template class MemoryDynamic : public Allocator return p; } }; - -/** - * A pool based allocator - * - */ -template class MemoryPool : public Allocator -{ - PointerQueue dead; - - T *buf; // our large raw block of memory - - size_t maxElements; - - public: - explicit MemoryPool(size_t _maxElements) : dead(_maxElements), maxElements(_maxElements) - { - buf = new T[maxElements]; - - // prefill dead - for (size_t i = 0; i < maxElements; i++) - release(&buf[i]); - } - - ~MemoryPool() { delete[] buf; } - - /// Return a buffer for use by others - void release(T *p) - { - assert(p >= buf && - (size_t)(p - buf) < - maxElements); // sanity check to make sure a programmer didn't free something that didn't come from this pool - assert(dead.enqueue(p, 0)); - } - -#ifdef HAS_FREE_RTOS - /// Return a buffer from an ISR, if higherPriWoken is set to true you have some work to do ;-) - void releaseFromISR(T *p, BaseType_t *higherPriWoken) - { - assert(p >= buf && - (size_t)(p - buf) < - maxElements); // sanity check to make sure a programmer didn't free something that didn't come from this pool - assert(dead.enqueueFromISR(p, higherPriWoken)); - } -#endif - - protected: - /// Return a queable object which has been prefilled with zeros - allow timeout to wait for available buffers (you - /// probably don't want this version). - virtual T *alloc(TickType_t maxWait) - { - T *p = dead.dequeuePtr(maxWait); - assert(p); - return p; - } -};