LMMS
Loading...
Searching...
No Matches
rtmempool.h File Reference
#include <stdbool.h>
#include <stddef.h>

Go to the source code of this file.

Macros

#define RTSAFE_MEMORY_POOL_NAME_MAX   128

Typedefs

typedef voidRtMemPool_Handle

Functions

bool rtsafe_memory_pool_create (RtMemPool_Handle *handlePtr, const char *poolName, size_t dataSize, size_t minPreallocated, size_t maxPreallocated)
void rtsafe_memory_pool_destroy (RtMemPool_Handle handle)
voidrtsafe_memory_pool_allocate_atomic (RtMemPool_Handle handle)
voidrtsafe_memory_pool_allocate_sleepy (RtMemPool_Handle handle)
void rtsafe_memory_pool_deallocate (RtMemPool_Handle handle, void *memoryPtr)

Macro Definition Documentation

◆ RTSAFE_MEMORY_POOL_NAME_MAX

#define RTSAFE_MEMORY_POOL_NAME_MAX   128

max size of memory pool name, in chars, including terminating zero char

Typedef Documentation

◆ RtMemPool_Handle

Opaque data for RtMemPool_Pool.

Function Documentation

◆ rtsafe_memory_pool_allocate_atomic()

void * rtsafe_memory_pool_allocate_atomic ( RtMemPool_Handle handle)

Allocate memory in context where sleeping is not allowed

will not sleep

Returns
Pointer to allocated memory or NULL if memory no memory is available

◆ rtsafe_memory_pool_allocate_sleepy()

void * rtsafe_memory_pool_allocate_sleepy ( RtMemPool_Handle handle)

Allocate memory in context where sleeping is allowed

may/will sleep

Returns
Pointer to allocated memory or NULL if memory no memory is available (should not happen under normal conditions)

◆ rtsafe_memory_pool_create()

bool rtsafe_memory_pool_create ( RtMemPool_Handle * handlePtr,
const char * poolName,
size_t dataSize,
size_t minPreallocated,
size_t maxPreallocated )

Create new memory pool

may/will sleep

Parameters
poolNamepool name, for debug purposes, max RTSAFE_MEMORY_POOL_NAME_MAX chars, including terminating zero char. May be NULL.
dataSizememory chunk size
minPreallocatedmin chunks preallocated
maxPreallocatedmax chunks preallocated
Returns
Success status, true if successful

◆ rtsafe_memory_pool_deallocate()

void rtsafe_memory_pool_deallocate ( RtMemPool_Handle handle,
void * memoryPtr )

Deallocate previously allocated memory

will not sleep

Parameters
memoryPtrpointer to previously allocated memory chunk

◆ rtsafe_memory_pool_destroy()

void rtsafe_memory_pool_destroy ( RtMemPool_Handle handle)

Destroy previously created memory pool

may/will sleep