|
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Fixed-size block pool that owns its storage: no heap, no separately declared (and possibly mis-sized or misaligned) buffer, everything is computed at compile time. More...
#include <stk_memory_blockpool.h>
Public Member Functions | |
| StaticBlockPool (const char *name=nullptr) | |
| void * | TimedAlloc (Timeout timeout_ticks=WAIT_INFINITE) |
| Allocate one block, blocking until one becomes available or the timeout expires. | |
| EWaitResult | TimedAllocEx (void **block, Timeout timeout_ticks=WAIT_INFINITE) |
| Allocate one block, preserving the full wait outcome. | |
| template<typename T> | |
| T * | TimedAllocT (Timeout timeout_ticks=WAIT_INFINITE) |
| Allocate one typed block, blocking until one becomes available or the timeout expires. | |
| void * | Alloc () |
| Allocate one block, blocking indefinitely until one is available. | |
| template<typename T> | |
| T * | AllocT () |
| Allocate one typed block, blocking indefinitely until one is available. | |
| void * | TryAlloc () |
| Non-blocking allocation attempt. | |
| template<typename T> | |
| T * | TryAllocT () |
| Non-blocking typed allocation attempt. | |
| template<typename T, typename... TArgs> | |
| T * | TimedNewT (Timeout timeout_ticks, TArgs &&...args) |
Allocate one block and construct a T in it (placement new), waiting up to timeout_ticks. | |
| template<typename T, typename... TArgs> | |
| T * | NewT (TArgs &&...args) |
Allocate one block and construct a T in it, blocking indefinitely. | |
| template<typename T, typename... TArgs> | |
| T * | TryNewT (TArgs &&...args) |
Non-blocking TimedNewT(). ISR-safe if the constructor of T is. | |
| template<typename T> | |
| void | DeleteT (T *ptr) |
| Destroy an object created with the NewT() family and return its block to the pool. | |
| template<typename T, typename... TArgs> | |
| PoolPtr< T, BlockMemoryPool > | TryMakeT (TArgs &&...args) |
| Non-blocking allocate-and-construct returning an owning PoolPtr. | |
| template<typename T, typename... TArgs> | |
| PoolPtr< T, BlockMemoryPool > | MakeT (TArgs &&...args) |
| Blocking allocate-and-construct returning an owning PoolPtr. | |
| bool | Free (void *ptr) |
| Return a previously allocated block to the pool. | |
| bool | IsStorageValid () const |
| Verify that the backing storage is valid and the pool is ready for use. | |
| size_t | GetCapacity () const |
| Get the total block capacity of the pool. | |
| size_t | GetBlockSize () const |
| Get the aligned block size used internally by the allocator. | |
| size_t | GetBlockAlignment () const |
| Get the alignment (bytes) of every block. | |
| size_t | GetUsedCount () const |
| Get the number of currently allocated (outstanding) blocks. | |
| size_t | GetFreeCount () const |
| Get the number of free (available) blocks. | |
| size_t | GetPeakUsedCount () const |
| Get the high watermark: the maximum number of blocks that were allocated at the same time. | |
| size_t | GetAllocFailCount () const |
Get the number of allocation requests that failed because the pool was exhausted (timeouts and NO_WAIT misses). | |
| MemoryAllocator::Stats | GetStats () const |
| Get a consistent statistics snapshot in the same format as MemoryAllocator::GetStats(). | |
| bool | IsFull () const |
| Check whether all blocks are currently allocated (pool exhausted). | |
| bool | IsEmpty () const |
| Check whether all blocks are free (no outstanding allocations). | |
| void | SetTraceName (const char *name) |
| Set name. | |
| const char * | GetTraceName () const |
| Get name. | |
Static Public Member Functions | |
| static constexpr size_t | AlignBlockSize (size_t raw_size, size_t alignment=ALIGN_DEFAULT) |
| Round a raw block size up to the nearest multiple of alignment. | |
| static constexpr size_t | BitmapBytes (size_t capacity) |
| Number of bytes of the "allocated" bitmap for capacity blocks. | |
| static constexpr size_t | RequiredStorageSize (size_t capacity, size_t raw_block_size, size_t alignment=ALIGN_DEFAULT) |
| Compute the size of the storage buffer required for an external-storage pool. | |
Static Public Attributes | |
| static const size_t | CAPACITY_MAX = 0xFFFEU |
| Max capacity supported (number of blocks). | |
| static const size_t | ALIGN_DEFAULT = stk::memory::MemoryAllocator::MIN_ALIGNMENT |
Default block alignment in bytes (see STK_MEMORY_BLOCKPOOL_ALIGN_DEFAULT). | |
Private Member Functions | |
| STK_STATIC_ASSERT_DESC (TBlockSize > 0U, "block size must be greater than zero") | |
| STK_STATIC_ASSERT_DESC ((TCapacity > 0U) &&(TCapacity<=BlockMemoryPool::CAPACITY_MAX), "invalid capacity") | |
| STK_STATIC_ASSERT_DESC ((TAlign >=sizeof(void *)) &&((TAlign &(TAlign - 1U))==0U), "alignment must be a power of two not less than sizeof(void *)") | |
| STK_NONCOPYABLE_CLASS (BlockMemoryPool) | |
| void | Setup (size_t raw_block_size, size_t alignment) |
| Align storage, trim the capacity to what fits and build the free-list. | |
| void | BuildFreeList () |
Initialise the intrusive free-list across m_blocks. | |
| void * | PopFreeList () |
Pop the head block from the free-list, increment m_used_count, and return it. | |
Static Private Member Functions | |
| static bool | IsValidAlignment (size_t alignment) |
| Check an alignment value: a power of two, large enough for the free-list link. | |
| static bool | ArgsValid (size_t capacity, size_t raw_block_size, size_t alignment, size_t block_size) |
| Check constructor arguments (block size overflow included). | |
| static __stk_forceinline void | Fill (void *ptr, size_t size, uint8_t value) |
| Fill size bytes at ptr with value (used by diagnostics only). | |
Private Attributes | |
| uint8_t | m_buf [BlockMemoryPool::RequiredStorageSize(TCapacity, TBlockSize, TAlign)] |
| uint8_t * | m_storage |
| raw storage as supplied or allocated (before alignment) | |
| uint8_t * | m_blocks |
| aligned start of block 0, nullptr if the pool is invalid | |
| uint8_t * | m_bitmap |
| "allocated" bitmap (STK_MEMORY_BLOCKPOOL_BITMAP), otherwise unused | |
| MemoryBlock * | m_free_list |
| head of the intrusive free-list (nullptr when pool is empty) | |
| sync::ConditionVariable | m_cv |
| signalled by Free() to wake one task blocked in TimedAlloc() | |
| size_t | m_storage_size |
| size of the raw storage in bytes | |
| size_t | m_block_size |
| aligned block size in bytes (>= m_block_align) | |
| size_t | m_block_align |
| alignment of every block in bytes | |
| size_t | m_capacity |
| total number of blocks (0 if invalid) | |
| size_t | m_used_count |
| number of blocks currently allocated (outstanding) | |
| MemoryAllocator::Stats | m_stats |
| live statistics in bytes (blocks * block size): usage, watermark, counters | |
| bool | m_storage_owned |
| true -> storage is heap-allocated; free in destructor | |
Static Private Attributes | |
| static const uint8_t | FILL_ALLOC = 0xCDU |
| payload fill on allocation (STK_MEMORY_POOL_CHECKS) | |
| static const uint8_t | FILL_FREE = 0xDDU |
| payload fill on free (STK_MEMORY_POOL_CHECKS) | |
Fixed-size block pool that owns its storage: no heap, no separately declared (and possibly mis-sized or misaligned) buffer, everything is computed at compile time.
| TBlockSize | Requested block size in bytes (e.g. sizeof(Packet)). |
| TCapacity | Number of blocks. |
| TAlign | Block alignment in bytes (power of two), default BlockMemoryPool::ALIGN_DEFAULT. Fixed-size block pool that owns its storage: no heap, no separately declared (and possibly mis-sized ... Definition stk_memory_blockpool.h:1054 |
Definition at line 1052 of file stk_memory_blockpool.h.
|
inlineexplicit |
Definition at line 1061 of file stk_memory_blockpool.h.
|
inlinestaticconstexprinherited |
Round a raw block size up to the nearest multiple of alignment.
Enforces a minimum of alignment so the free-list link always fits inside every free block without extra metadata.
| [in] | raw_size | Requested block size in bytes. |
| [in] | alignment | Block alignment (power of two), ALIGN_DEFAULT by default. |
Definition at line 203 of file stk_memory_blockpool.h.
References ALIGN_DEFAULT, and stk::Max().
Referenced by BlockMemoryPool(), BlockMemoryPool(), osMemoryPoolNew(), RequiredStorageSize(), STK_STATIC_ASSERT_DESC(), tx_block_pool_create(), xMessageBufferCreateStatic(), xMessageBufferCreateStaticWithCallback(), and xMessageBufferCreateWithCallback().
|
inlineinherited |
Allocate one block, blocking indefinitely until one is available.
nullptr only if the wait was cancelled via IKernel::CancelTaskWait() or the pool is invalid; never on timeout (there is none). Use TimedAllocEx() if cancellation must be told apart from other failures. Definition at line 739 of file stk_memory_blockpool.h.
References TimedAlloc(), and stk::WAIT_INFINITE.
Referenced by stk_blockpool_alloc().
|
inlineinherited |
Allocate one typed block, blocking indefinitely until one is available.
nullptr only if the wait was cancelled, the pool is invalid or T does not fit (see Alloc()). Definition at line 745 of file stk_memory_blockpool.h.
References TimedAllocT(), and stk::WAIT_INFINITE.
|
inlinestaticprivateinherited |
Check constructor arguments (block size overflow included).
Definition at line 467 of file stk_memory_blockpool.h.
References CAPACITY_MAX, and IsValidAlignment().
Referenced by BlockMemoryPool(), and Setup().
|
inlinestaticconstexprinherited |
Number of bytes of the "allocated" bitmap for capacity blocks.
STK_MEMORY_BLOCKPOOL_BITMAP is 1. Definition at line 211 of file stk_memory_blockpool.h.
References STK_MEMORY_BLOCKPOOL_BITMAP.
Referenced by BlockMemoryPool(), BuildFreeList(), RequiredStorageSize(), Setup(), and STK_STATIC_ASSERT_DESC().
|
inlineprivateinherited |
Initialise the intrusive free-list across m_blocks.
Links blocks in reverse order so after the loop m_free_list points to block_0 (lowest address), giving ascending allocation order. Each free block stores a pointer to the next free block in its own first sizeof(MemoryBlock) bytes - zero extra metadata.
Definition at line 975 of file stk_memory_blockpool.h.
References BitmapBytes(), m_bitmap, m_block_align, m_block_size, m_blocks, m_capacity, m_free_list, m_used_count, stk::memory::BlockMemoryPool::MemoryBlock::next, stk::hw::PtrToWord(), STK_ASSERT, and stk::hw::WordToPtr().
Referenced by Setup().
|
inlineinherited |
Destroy an object created with the NewT() family and return its block to the pool.
| [in] | ptr | Object pointer, nullptr is allowed and results in noop. |
T is. Definition at line 794 of file stk_memory_blockpool.h.
References Free(), and STK_UNUSED.
|
inlinestaticprivateinherited |
Fill size bytes at ptr with value (used by diagnostics only).
Definition at line 493 of file stk_memory_blockpool.h.
References __stk_forceinline, and stk::STK_MEMSET().
Referenced by Free(), and PopFreeList().
|
inlineinherited |
Return a previously allocated block to the pool.
Pushes the block back onto the free-list head in O(1) and wakes exactly one task blocked inside Alloc() or TimedAlloc(), if any, so it can re-check for a free block. Under contention from TryAlloc() (including from another task or an ISR racing in before the woken task is scheduled), that task may find the block already taken and continue waiting rather than being guaranteed one on this wake.
| [in] | ptr | Pointer previously returned by Alloc(), TimedAlloc(), or TryAlloc(). Must not be nullptr and must belong to this pool instance. Bounds and alignment are validated; failures trigger an assertion in debug builds and return false in release builds. |
true - block successfully returned. false - ptr is nullptr, out of range, misaligned or already free (double-free, release-build detection requires STK_MEMORY_BLOCKPOOL_BITMAP); each case indicates a caller logic error. STK_MEMORY_BLOCKPOOL_BITMAP a double-free is detected only if the pool is already fully free, or in builds with STK_MEMORY_POOL_CHECKS (O(n) free-list walk); otherwise it silently corrupts the free-list. Null the pointer after Free(). Definition at line 823 of file stk_memory_blockpool.h.
References Fill(), FILL_FREE, m_block_size, m_blocks, m_capacity, m_cv, m_free_list, m_stats, m_used_count, stk::memory::BlockMemoryPool::MemoryBlock::next, stk::hw::PtrToWord(), and STK_ASSERT.
Referenced by DeleteT(), stk_blockpool_free(), xMessageBufferReceive(), xMessageBufferReceiveFromISR(), xMessageBufferReset(), xMessageBufferResetFromISR(), xMessageBufferSend(), and xMessageBufferSendFromISR().
|
inlineinherited |
Get the number of allocation requests that failed because the pool was exhausted (timeouts and NO_WAIT misses).
size_t read is a single instruction. Definition at line 421 of file stk_memory_blockpool.h.
References m_stats.
Referenced by stk_blockpool_get_alloc_fail_count().
|
inlineinherited |
Get the alignment (bytes) of every block.
Definition at line 395 of file stk_memory_blockpool.h.
References m_block_align.
Referenced by stk_blockpool_get_block_alignment().
|
inlineinherited |
Get the aligned block size used internally by the allocator.
Equal to AlignBlockSize(raw_block_size, alignment) passed at construction. Matches osMemoryPoolGetBlockSize().
Definition at line 390 of file stk_memory_blockpool.h.
References m_block_size.
Referenced by stk_blockpool_get_block_size().
|
inlineinherited |
Get the total block capacity of the pool.
osMemoryPoolGetCapacity(). Can be lower than requested if the supplied buffer was too small (debug builds assert), 0 for an invalid pool. Definition at line 382 of file stk_memory_blockpool.h.
References m_capacity.
Referenced by stk_blockpool_get_capacity(), and tx_block_pool_info_get().
|
inlineinherited |
Get the number of free (available) blocks.
GetCapacity() - GetUsedCount(). Matches osMemoryPoolGetSpace(). Definition at line 409 of file stk_memory_blockpool.h.
References m_capacity, and m_used_count.
Referenced by IsFull(), stk_blockpool_get_free_count(), and tx_block_pool_info_get().
|
inlineinherited |
Get the high watermark: the maximum number of blocks that were allocated at the same time.
Run your worst-case workload and use this value to size the pool.
size_t read is a single instruction. Definition at line 415 of file stk_memory_blockpool.h.
References m_block_size, and m_stats.
Referenced by stk_blockpool_get_peak_used_count().
|
inlineinherited |
Get a consistent statistics snapshot in the same format as MemoryAllocator::GetStats().
All values are in bytes (blocks * block size); counters are in operations.
Definition at line 912 of file stk_memory_blockpool.h.
References m_stats.
Referenced by stk_blockpool_get_stats().
|
inlineinherited |
Get name.
NULL if not set or if STK_SYNC_DEBUG_NAMES is 0. Definition at line 629 of file stk_common.h.
|
inlineinherited |
Get the number of currently allocated (outstanding) blocks.
osMemoryPoolGetCount(). size_t read is a single instruction. Definition at line 402 of file stk_memory_blockpool.h.
References m_used_count.
Referenced by stk_blockpool_get_used_count().
|
inlineinherited |
Check whether all blocks are free (no outstanding allocations).
true if no blocks are currently allocated. Definition at line 440 of file stk_memory_blockpool.h.
References m_used_count.
Referenced by stk_blockpool_is_empty().
|
inlineinherited |
Check whether all blocks are currently allocated (pool exhausted).
true if no blocks are available for allocation. Definition at line 434 of file stk_memory_blockpool.h.
References GetFreeCount().
Referenced by stk_blockpool_is_full().
|
inlineinherited |
Verify that the backing storage is valid and the pool is ready for use.
false if the constructor arguments were invalid, a heap allocation failed, or the supplied buffer is too small to hold a single block. Must be checked after the heap constructor when operating without exceptions (the typical embedded configuration). An invalid pool fails every allocation immediately instead of blocking forever.
true if the pool is ready for use. Definition at line 374 of file stk_memory_blockpool.h.
References m_blocks, and m_capacity.
Referenced by osMemoryPoolNew(), stk_blockpool_is_storage_valid(), TimedAllocEx(), and xMessageBufferCreate().
|
inlinestaticprivateinherited |
Check an alignment value: a power of two, large enough for the free-list link.
Definition at line 460 of file stk_memory_blockpool.h.
Referenced by ArgsValid(), and Setup().
|
inlineinherited |
Blocking allocate-and-construct returning an owning PoolPtr.
Definition at line 812 of file stk_memory_blockpool.h.
References NewT().
|
inlineinherited |
Allocate one block and construct a T in it, blocking indefinitely.
Definition at line 782 of file stk_memory_blockpool.h.
References TimedNewT(), and stk::WAIT_INFINITE.
Referenced by MakeT().
|
inlineprivateinherited |
Pop the head block from the free-list, increment m_used_count, and return it.
m_free_list != nullptr. Definition at line 1000 of file stk_memory_blockpool.h.
References Fill(), FILL_ALLOC, m_block_size, m_blocks, m_capacity, m_free_list, m_stats, m_used_count, stk::memory::BlockMemoryPool::MemoryBlock::next, stk::hw::PtrToWord(), and STK_ASSERT.
Referenced by TimedAllocEx().
|
inlinestaticconstexprinherited |
Compute the size of the storage buffer required for an external-storage pool.
Accounts for the aligned block size and the optional bitmap. If you cannot guarantee that the buffer is aligned to alignment add alignment - 1.
| [in] | capacity | Number of blocks. |
| [in] | raw_block_size | Requested per-block size in bytes. |
| [in] | alignment | Block alignment (power of two), ALIGN_DEFAULT by default. |
Definition at line 227 of file stk_memory_blockpool.h.
References ALIGN_DEFAULT, AlignBlockSize(), and BitmapBytes().
Referenced by stk_blockpool_create_static_ex(), and STK_STATIC_ASSERT_DESC().
|
inlineinherited |
Set name.
| [in] | name | Null-terminated string or NULL. |
Definition at line 617 of file stk_common.h.
References STK_UNUSED.
Referenced by stk::memory::BlockMemoryPool::BlockMemoryPool(), stk::memory::BlockMemoryPool::BlockMemoryPool(), stk::memory::BytePool::BytePool(), stk::memory::BytePool::BytePool(), RunExample(), tx_block_pool_create(), tx_mutex_create(), and tx_queue_create().
|
inlineprivateinherited |
Align storage, trim the capacity to what fits and build the free-list.
Definition at line 923 of file stk_memory_blockpool.h.
References ArgsValid(), BitmapBytes(), BuildFreeList(), CAPACITY_MAX, IsValidAlignment(), m_bitmap, m_block_size, m_blocks, m_capacity, m_free_list, m_stats, m_storage, m_storage_size, m_used_count, stk::hw::PtrToWord(), and STK_ASSERT.
Referenced by BlockMemoryPool(), and BlockMemoryPool().
|
privateinherited |
|
private |
|
private |
|
private |
|
inlineinherited |
Allocate one block, blocking until one becomes available or the timeout expires.
If the pool is empty the calling task is suspended via the internal ConditionVariable and woken by the next Free() call. On return the caller owns the block and must eventually return it via Free().
| [in] | timeout_ticks | Maximum time to wait (ticks). WAIT_INFINITE - block indefinitely (default). NO_WAIT - return nullptr immediately if pool is empty (identical to TryAlloc(); ISR-safe). |
GetBlockSize() bytes, or nullptr if the timeout expired, the pool is invalid (see IsStorageValid()), or the wait was cancelled via IKernel::CancelTaskWait() before a block became available. TimedAllocEx() to tell them apart. NO_WAIT; ISR-unsafe otherwise. Definition at line 710 of file stk_memory_blockpool.h.
References TimedAllocEx(), and stk::WAIT_RESULT_SIGNAL.
Referenced by Alloc(), stk_blockpool_timed_alloc(), TimedAllocT(), TryAlloc(), xMessageBufferSend(), and xMessageBufferSendFromISR().
|
inlineinherited |
Allocate one block, preserving the full wait outcome.
Identical to TimedAlloc(), except the caller gets the raw EWaitResult so a cancellation (via IKernel::CancelTaskWait()) can be distinguished from a timeout. Mirrors sync::Event::WaitEx().
| [out] | block | Receives the allocated block on WAIT_RESULT_SIGNAL, nullptr on any other result. Must not be nullptr. |
| [in] | timeout_ticks | Same as TimedAlloc(). |
WAIT_RESULT_SIGNAL - a block was allocated (immediately or after waiting), WAIT_RESULT_TIMEOUT - no block became available before the timeout (or NO_WAIT was passed on an empty pool); a block freed at the very moment the timeout expired is still returned as SIGNAL, WAIT_RESULT_CANCELED - the wait was cancelled, nothing was allocated, WAIT_RESULT_FAIL - invalid arguments, invalid pool (no usable storage) or the kernel rejected the wait. NO_WAIT; ISR-unsafe otherwise. Definition at line 615 of file stk_memory_blockpool.h.
References stk::GetTicks(), stk::hw::IsInsideISR(), IsStorageValid(), m_cv, m_free_list, m_stats, stk::NO_WAIT, PopFreeList(), STK_ASSERT, stk::WAIT_INFINITE, stk::WAIT_RESULT_FAIL, stk::WAIT_RESULT_SIGNAL, and stk::WAIT_RESULT_TIMEOUT.
Referenced by stk_blockpool_timed_alloc_ex(), and TimedAlloc().
|
inlineinherited |
Allocate one typed block, blocking until one becomes available or the timeout expires.
Thin typed wrapper around TimedAlloc(). The memory is uninitialized; no constructor is run (see TimedNewT()). Returns nullptr (and asserts in debug builds) if sizeof(T) exceeds the block size or alignof(T) exceeds the pool alignment.
| [in] | timeout_ticks | Maximum time to wait (ticks). Same semantics as TimedAlloc(). |
nullptr if the timeout expired or T does not fit. NO_WAIT; ISR-unsafe otherwise. Definition at line 723 of file stk_memory_blockpool.h.
References m_block_align, m_block_size, STK_ASSERT, and TimedAlloc().
Referenced by AllocT(), TimedNewT(), and TryAllocT().
|
inlineinherited |
Allocate one block and construct a T in it (placement new), waiting up to timeout_ticks.
| [in] | timeout_ticks | Maximum time to wait (ticks). |
| [in] | args | Constructor arguments forwarded to T. |
nullptr (see TimedAllocT()). DeleteT(). ISR-safe only with NO_WAIT (and only if the constructor is). Definition at line 768 of file stk_memory_blockpool.h.
References STK_UNUSED, and TimedAllocT().
Referenced by NewT(), and TryNewT().
|
inlineinherited |
Non-blocking allocation attempt.
Returns a block immediately if the pool is not empty, or nullptr if all blocks are currently allocated. Never suspends the calling task and never touches the condition variable.
nullptr if the pool is empty. Definition at line 750 of file stk_memory_blockpool.h.
References stk::NO_WAIT, and TimedAlloc().
Referenced by stk::pthread::AllocateStack(), and stk_blockpool_try_alloc().
|
inlineinherited |
Non-blocking typed allocation attempt.
Returns a typed pointer immediately if the pool is not empty, or nullptr if all blocks are currently allocated. Never suspends the calling task.
nullptr if the pool is empty. Definition at line 756 of file stk_memory_blockpool.h.
References stk::NO_WAIT, and TimedAllocT().
|
inlineinherited |
Non-blocking allocate-and-construct returning an owning PoolPtr.
Definition at line 806 of file stk_memory_blockpool.h.
References TryNewT().
|
inlineinherited |
Non-blocking TimedNewT(). ISR-safe if the constructor of T is.
Definition at line 788 of file stk_memory_blockpool.h.
References stk::NO_WAIT, and TimedNewT().
Referenced by TryMakeT().
|
staticinherited |
Default block alignment in bytes (see STK_MEMORY_BLOCKPOOL_ALIGN_DEFAULT).
Definition at line 141 of file stk_memory_blockpool.h.
Referenced by AlignBlockSize(), RequiredStorageSize(), stk_blockpool_create(), stk_blockpool_create_static(), and STK_STATIC_ASSERT_DESC().
|
staticinherited |
Max capacity supported (number of blocks).
Definition at line 137 of file stk_memory_blockpool.h.
Referenced by ArgsValid(), Setup(), stk::memory::StaticBlockPool< sizeof(T), N,((alignof(T) > BlockMemoryPool::ALIGN_DEFAULT) ? alignof(T) :BlockMemoryPool::ALIGN_DEFAULT)>::STK_STATIC_ASSERT_DESC(), and tx_block_pool_create().
|
staticprivateinherited |
payload fill on allocation (STK_MEMORY_POOL_CHECKS)
Definition at line 455 of file stk_memory_blockpool.h.
Referenced by PopFreeList().
|
staticprivateinherited |
payload fill on free (STK_MEMORY_POOL_CHECKS)
Definition at line 456 of file stk_memory_blockpool.h.
Referenced by Free().
|
privateinherited |
"allocated" bitmap (STK_MEMORY_BLOCKPOOL_BITMAP), otherwise unused
Definition at line 506 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), and Setup().
|
privateinherited |
alignment of every block in bytes
Definition at line 511 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), GetBlockAlignment(), and TimedAllocT().
|
privateinherited |
aligned block size in bytes (>= m_block_align)
Definition at line 510 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), Free(), GetBlockSize(), GetPeakUsedCount(), PopFreeList(), Setup(), and TimedAllocT().
|
privateinherited |
aligned start of block 0, nullptr if the pool is invalid
Definition at line 505 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), Free(), IsStorageValid(), PopFreeList(), Setup(), and ~BlockMemoryPool().
|
inherited |
Definition at line 1034 of file stk_memory_blockpool.h.
|
privateinherited |
total number of blocks (0 if invalid)
Definition at line 512 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), Free(), GetCapacity(), GetFreeCount(), IsStorageValid(), PopFreeList(), and Setup().
|
privateinherited |
signalled by Free() to wake one task blocked in TimedAlloc()
Definition at line 508 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), Free(), and TimedAllocEx().
|
privateinherited |
head of the intrusive free-list (nullptr when pool is empty)
Definition at line 507 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), Free(), PopFreeList(), Setup(), and TimedAllocEx().
|
privateinherited |
live statistics in bytes (blocks * block size): usage, watermark, counters
Definition at line 514 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), Free(), GetAllocFailCount(), GetPeakUsedCount(), GetStats(), PopFreeList(), Setup(), and TimedAllocEx().
|
privateinherited |
raw storage as supplied or allocated (before alignment)
Definition at line 504 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), Setup(), and ~BlockMemoryPool().
|
privateinherited |
true -> storage is heap-allocated; free in destructor
Definition at line 515 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), and ~BlockMemoryPool().
|
privateinherited |
size of the raw storage in bytes
Definition at line 509 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), and Setup().
|
privateinherited |
number of blocks currently allocated (outstanding)
Definition at line 513 of file stk_memory_blockpool.h.
Referenced by BlockMemoryPool(), BlockMemoryPool(), BuildFreeList(), Free(), GetFreeCount(), GetUsedCount(), IsEmpty(), PopFreeList(), Setup(), and ~BlockMemoryPool().