Defines the data structure used to memory block pool facility. More...
|The head of the linked list of free blocks. More...|
|Number of free blocks remaining. |
|Total number of blocks in bytes. More...|
|Maximum block size in bytes. More...|
|The start of the original pool buffer. More...|
|The last block in this pool. |
|Minimum number of free blocks ever in this pool, i.e. holds the lowest number of free blocks ever present in the pool. More...|
Defines the data structure used to memory block pool facility.
Since memory block pools consist of fixed-size blocks, there are never any fragmentation problems. Of course, fragmentation causes behavior that is inherently un-deterministic. In addition, the time required to allocate and free a fixed-size memory is comparable to that of simple linked-list manipulation. Lack of flexibility is the main drawback of fixed-size memory pools. The block size of a pool must be large enough to handle the worst case memory requirements of its users. Of course, memory may be wasted if many different size memory requests are made to the same pool. A possible solution is to make several different memory block pools that contain different sized memory blocks. Each memory block pool is a public resource.
The memory block pools contain a number of fixed-size blocks. The block size, in bytes, is specified during creation of the pool. Each memory block in the pool imposes a small amount of overhead the size of a C pointer. In addition, RKH may pad the block size in order to keep the beginning of each memory block on proper alignment.
The number of memory blocks in a pool depends on the block size and the total number of bytes in the memory area supplied during creation. To calculate the capacity of a pool (number of blocks that will be available), divide the block size (including padding and the pointer overhead bytes) into the total number of bytes in the supplied memory area.
The memory area for the block pool is specified during creation, and can be located anywhere in the target's address space. This is an important feature because of the considerable flexibility it gives the application.
Total number of blocks in bytes.
The type RKH_MPNB_T is configurable by the macro RKH_CFG_MP_SIZEOF_NBLOCK. The valid values [in bits] are 8, 16 or 32. Default is 8. The dynamic range of the RKH_MPNB_T data type determines the maximum number of blocks that can be stored in the pool.
Maximum block size in bytes.
The type RKH_MPBS_T is configurable by the macro RKH_CFG_MP_SIZEOF_BSIZE. The valid values [in bits] are 8, 16 or 32. Default is 8. The dynamic range of the RKH_MPBS_T data type determines the maximum size of blocks that can be managed by the pool manager.