Dynamic memory pools are a pool of memory blocks that can be dynamically allocated and freed at run-time. Their memory blocks are allocated on a given Memory Segment. They have the particularity that if there is no block available when attempting to get one, it will be allocated from free space on the memory segment.
Note that the dynamic memory pools DO NOT guarantee the data integrity between a block free and a block get operation.
The dynamic memory pools can be used to allocate general-purpose memory blocks and hardware memory blocks. Hence, two different functions can be used to create a dynamic memory pool:
Function | Description | Use case |
---|---|---|
Mem_DynPoolCreate() | Creates a standard memory pool and allows to specify the memory alignment of each memory block. | General-purpose memory block. |
Mem_DynPoolCreateHW() | Creates a hardware memory pool. The memory blocks will be aligned as specified and padded as per memory segment properties. | Memory blocks that can be read/written via a DMA engine. |
Dynamic memory pool usage example
gives a usage example of dynamic memory pools.