QP/C  8.0.2
Real-Time Embedded Framework
Loading...
Searching...
No Matches
QMPool Class Reference

Native QF Memory Pool. More...

#include "qmpool.h"

Public Member Functions

void QMPool_init (QMPool *const me, void *const poolSto, uint_fast32_t const poolSize, uint_fast16_t const blockSize)
 
void * QMPool_get (QMPool *const me, uint_fast16_t const margin, uint_fast8_t const qsId)
 
void QMPool_put (QMPool *const me, void *const block, uint_fast8_t const qsId)
 

Private Attributes

void ** start
 Start of the memory managed by this memory pool.
 
void ** end
 End of the memory managed by this memory pool.
 
void **volatile freeHead
 
QMPoolSize blockSize
 Memory block size [bytes] held by this fixed-size pool.
 
QMPoolCtr nTot
 Total number of memory blocks in this pool.
 
QMPoolCtr volatile nFree
 Number of free memory blocks remaining in the pool at this point.
 
QMPoolCtr nMin
 Minimum number of free blocks ever present in this pool.
 

Detailed Description

Native QF Memory Pool.

Details

A fixed block-size memory pool is a very fast and efficient data structure for dynamic allocation of fixed block-size chunks of memory. A memory pool offers fast and deterministic allocation and recycling of memory blocks and is not subject to fragmentation.

The QMPool class describes the native QF memory pool, which can be used as the event pool for mutable event allocation, or as a fast, deterministic fixed block-size heap for any other objects in your application.

Note
QMPool contains only data members for managing a memory pool, but does not contain the pool storage, which must be provided externally during the pool initialization.

Definition at line 67 of file qmpool.h.

Member Function Documentation

◆ QMPool_init()

void QMPool_init ( QMPool *const me,
void *const poolSto,
uint_fast32_t const poolSize,
uint_fast16_t const blockSize )

◆ QMPool_get()

void * QMPool_get ( QMPool *const me,
uint_fast16_t const margin,
uint_fast8_t const qsId )

Definition at line 101 of file qf_mem.c.

◆ QMPool_put()

void QMPool_put ( QMPool *const me,
void *const block,
uint_fast8_t const qsId )

Definition at line 173 of file qf_mem.c.

Member Data Documentation

◆ start

void* * start
private

Start of the memory managed by this memory pool.

Definition at line 68 of file qmpool.h.

◆ end

void* * end
private

End of the memory managed by this memory pool.

Definition at line 69 of file qmpool.h.

◆ freeHead

void* * volatile freeHead
private

Definition at line 70 of file qmpool.h.

◆ blockSize

QMPoolSize blockSize
private

Memory block size [bytes] held by this fixed-size pool.

Definition at line 71 of file qmpool.h.

◆ nTot

QMPoolCtr nTot
private

Total number of memory blocks in this pool.

Definition at line 72 of file qmpool.h.

◆ nFree

QMPoolCtr volatile nFree
private

Number of free memory blocks remaining in the pool at this point.

Definition at line 73 of file qmpool.h.

◆ nMin

QMPoolCtr nMin
private

Minimum number of free blocks ever present in this pool.

Details

This attribute remembers the low watermark of the pool, which provides a valuable information for sizing event pools. (

See also
QF_getPoolMin()).

Definition at line 74 of file qmpool.h.


The documentation for this class was generated from the following files: