Lee Shen / FTHR_USB_serial_qSPI
Embed: (wiki syntax)

« Back to documentation index

MemoryPool< T, pool_sz > Class Template Reference

MemoryPool< T, pool_sz > Class Template Reference
[Rtos]

Define and manage fixed-size memory pools of objects of a given type. More...

#include <MemoryPool.h>

Inherits NonCopyable< MemoryPool< T, pool_sz > >.

Public Member Functions

 MemoryPool ()
 Create and Initialize a memory pool.
 ~MemoryPool ()
 Destroy a memory pool.
T * alloc (void)
 Allocate a memory block of type T from a memory pool.
T * calloc (void)
 Allocate a memory block of type T from a memory pool and set memory block to zero.
osStatus free (T *block)
 Free a memory block.

Detailed Description

template<typename T, uint32_t pool_sz>
class rtos::MemoryPool< T, pool_sz >

Define and manage fixed-size memory pools of objects of a given type.

Template Parameters:
Tdata type of a single object (element).
queue_szmaximum number of objects (elements) in the memory pool.
Note:
Memory considerations: The memory pool data store and control structures will be created on current thread's stack, both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).

Definition at line 46 of file MemoryPool.h.