# Memory Pool --- ## Object Definitions ```c #define KPL_SLAB_HEADER(STRUCT) struct STRUCT *prev, *next; typedef struct _kpl_slab_obj { KPL_SLAB_HEADER(_kpl_slab_obj); } kpl_slab_obj; typedef struct _kpl_slab { size_t array_index; struct _kpl_slab *next; uint8_t array[]; } kpl_slab_alloc; typedef struct { uint32_t object_size, array_size; _Atomic size_t slab_length; kpl_slab *root; kpl_slab_obj *pool; pthread_mutex_t slab_pool_mutex; } kpl_slab; #define KPL_POOL_HEADER(STRUCT) KPL_SLAB_HEADER(STRUCT); uint32_t obj_byte_size typedef struct _kpl_pool_obj { KPL_POOL_HEADER(_kpl_pool_obj); } kpl_pool_obj; typedef strut { uint32_t min_obj_size; _Atomic size_t alloc_byte_size; kpl_pool_obj *root; pthread_mutex_t root_mutex; } kpl_pool; ``` ## Pool Object Size The max size of an object in the pool is 2 \*\* 32 This allows for 4 aligned bytes after the `POOL_HEADER` macro ## List Management ## Tree Management