SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
Loading...
Searching...
No Matches
stk::memory::detail Namespace Reference

Classes

struct  BlockPoolStorage
 Storage holder. Kept as a separate (first) base class so that the buffer exists before BlockMemoryPool's constructor links the free-list into it. More...
struct  BytePoolStorage
 Storage holder. Kept as a separate (first) base class so that the buffer exists before BytePool's constructor writes the first block header into it. More...

Functions

 STK_STATIC_ASSERT_DESC (BytePool::BLOCK_ALIGN >=MemoryAllocator::MIN_ALIGNMENT, "STK_MEMORY_BYTEPOOL_ALIGN_DEFAULT is below MemoryAllocator::MIN_ALIGNMENT: the default allocator would violate its contract")
static BytePool & DefaultHeapPool ()
 Get the default heap pool, creating it on the first call.

Variables

static uint8_t g_DefaultHeapArea [(8192U)]
static uint8_t g_DefaultHeapPoolMem [sizeof(BytePool)]
static BytePool *volatile g_DefaultHeapPool = nullptr

Function Documentation

◆ DefaultHeapPool()

BytePool & stk::memory::detail::DefaultHeapPool ( )
inlinestatic

Get the default heap pool, creating it on the first call.

Definition at line 58 of file stk_memory_allocator_default.h.

59{
60 if (g_DefaultHeapPool == nullptr)
61 {
63
64 if (g_DefaultHeapPool == nullptr)
65 {
66 g_DefaultHeapPool = new (static_cast<void *>(g_DefaultHeapPoolMem))
67 BytePool(g_DefaultHeapArea, sizeof(g_DefaultHeapArea), "stk.heap");
68 }
69 }
70
71 return *g_DefaultHeapPool;
72}
static BytePool *volatile g_DefaultHeapPool
static uint8_t g_DefaultHeapPoolMem[sizeof(BytePool)]
static uint8_t g_DefaultHeapArea[(8192U)]
Variable-size (first-fit) allocator with block coalescing and proper task-blocking semantics.
RAII instance that enters the critical section on construction and exits it on destruction.
Definition stk_arch.h:495

References g_DefaultHeapArea, g_DefaultHeapPool, and g_DefaultHeapPoolMem.

Referenced by stk::memory::MemoryAllocator::Weak::Allocate(), stk::memory::MemoryAllocator::Weak::Free(), and stk::memory::MemoryAllocator::Weak::GetStats().

Here is the caller graph for this function:

◆ STK_STATIC_ASSERT_DESC()

stk::memory::detail::STK_STATIC_ASSERT_DESC ( BytePool::BLOCK_ALIGN >=MemoryAllocator::MIN_ALIGNMENT ,
"STK_MEMORY_BYTEPOOL_ALIGN_DEFAULT is below MemoryAllocator::MIN_ALIGNMENT: the default allocator would violate its contract"  )

Variable Documentation

◆ g_DefaultHeapArea

uint8_t stk::memory::detail::g_DefaultHeapArea[(8192U)]
static

Definition at line 52 of file stk_memory_allocator_default.h.

Referenced by DefaultHeapPool().

◆ g_DefaultHeapPool

BytePool* volatile stk::memory::detail::g_DefaultHeapPool = nullptr
static

Definition at line 54 of file stk_memory_allocator_default.h.

Referenced by DefaultHeapPool().

◆ g_DefaultHeapPoolMem

uint8_t stk::memory::detail::g_DefaultHeapPoolMem[sizeof(BytePool)]
static

Definition at line 53 of file stk_memory_allocator_default.h.

Referenced by DefaultHeapPool().