CMSIS-DSP  
CMSIS DSP Software Library
 
Loading...
Searching...
No Matches
Memory allocator

Content

 Memory buffer allocator
 
 Vector / matrix buffer allocator
 
 Miscellaneous utilities for memory
 

Data Structures

struct  default_user_allocator_malloc_free
 Malloc memory allocator. More...
 
struct  user_allocator_aligned_malloc
 Memory allocation for aligned buffers. More...
 
struct  malloc_allocator< L >
 Default memory allocator for vectors and matrixes. More...
 
struct  ListElem
 Simple list of elements. More...
 
class  MemoryPool< BUF_SIZE, UserAllocator >
 This class describes a memory pool that can be used to build a memory allocator for vectors and matrixes. More...
 

Description


Data Structure Documentation

◆ arm_cmsis_dsp::default_user_allocator_malloc_free

struct arm_cmsis_dsp::default_user_allocator_malloc_free

Malloc memory allocator.

Static Public Member Functions

static char * malloc (const std::size_t bytes)
 Allocate a buffer.
 
static void free (char *const block)
 Free a buffer.
 

Member Function Documentation

◆ free()

static void free ( char *const  block)
inlinestatic

Free a buffer.

Parameters
blockThe buffer to free

◆ malloc()

static char * malloc ( const std::size_t  bytes)
inlinestatic

Allocate a buffer.

Parameters
[in]bytesThe bytes
Returns
A pointer to the allocated buffer

◆ arm_cmsis_dsp::user_allocator_aligned_malloc

struct arm_cmsis_dsp::user_allocator_aligned_malloc

Memory allocation for aligned buffers.

Static Public Member Functions

static char * malloc (const size_type bytes)
 Allocate a new buffer.
 
static void free (char *const block)
 Free a buffer.
 

Member Function Documentation

◆ free()

static void free ( char *const  block)
inlinestatic

Free a buffer.

Parameters
blockPointer to the buffer

◆ malloc()

static char * malloc ( const size_type  bytes)
inlinestatic

Allocate a new buffer.

Parameters
[in]bytesThe bytes
Returns
Pointer to the new buffer

◆ arm_cmsis_dsp::malloc_allocator

struct arm_cmsis_dsp::malloc_allocator
template<int L>
struct arm_cmsis_dsp::malloc_allocator< L >

Default memory allocator for vectors and matrixes.

Template Parameters
LSize known at build time in bytes

Static Public Member Functions

static char * allocate (vector_length_t sz) noexcept
 Allocate a buffer with size known at runtime.
 
static char * allocate () noexcept
 Allocate a buffer with size known at build time.
 
static void destroy (char *ptr) noexcept
 Destroys the given pointer.
 

Member Function Documentation

◆ allocate() [1/2]

static char * allocate ( )
inlinestaticnoexcept

Allocate a buffer with size known at build time.

Returns
Pointer to the buffer

◆ allocate() [2/2]

static char * allocate ( vector_length_t  sz)
inlinestaticnoexcept

Allocate a buffer with size known at runtime.

Parameters
[in]szThe size
Returns
Pointer to the buffer

◆ destroy()

static void destroy ( char *  ptr)
inlinestaticnoexcept

Destroys the given pointer.

Parameters
ptrThe pointer

◆ arm_cmsis_dsp::ListElem

struct arm_cmsis_dsp::ListElem

Simple list of elements.

◆ arm_cmsis_dsp::MemoryPool

class arm_cmsis_dsp::MemoryPool
template<int BUF_SIZE, typename UserAllocator = default_user_allocator_malloc_free>
class arm_cmsis_dsp::MemoryPool< BUF_SIZE, UserAllocator >

This class describes a memory pool that can be used to build a memory allocator for vectors and matrixes.

Template Parameters
BUF_SIZESize of a buffer known at build time
UserAllocatorMemory allocator to allocate the memory buffer

Public Member Functions

 MemoryPool (const uint16_t nbBufs)
 Create a new memory pool.
 
 ~MemoryPool ()
 Destroys the object.
 
char * get_new_buffer () noexcept
 Gets the new free buffer.
 
void recycle_buffer (char *buf) noexcept
 Release the buffer so that it can be reused.
 
void reset () noexcept
 Release all the buffers so that they can be reused.
 

Constructor & Destructor Documentation

◆ MemoryPool()

MemoryPool ( const uint16_t  nbBufs)
inlineexplicit

Create a new memory pool.

Parameters
[in]nbBufsThe number of buffers to pre-allocate

Member Function Documentation

◆ get_new_buffer()

char * get_new_buffer ( )
inlinenoexcept

Gets the new free buffer.

Returns
The new buffer.

◆ recycle_buffer()

void recycle_buffer ( char *  buf)
inlinenoexcept

Release the buffer so that it can be reused.

Parameters
bufThe buffer