diff --git a/m-mempool.h b/m-mempool.h index 0111c490..8c1aeb42 100644 --- a/m-mempool.h +++ b/m-mempool.h @@ -29,11 +29,19 @@ #include #include "m-core.h" +/* Fast Fixed Size thread unsafe allocator. + USAGE: + MEMPOOL_DEF(uint, unsigned int) + ... + memppol_uint_t m; + mempool_uint_init(m); + // alloc with mempool_uint_alloc(m); + // free with mempool_uin_free(m, ptr); + mempool_uint_clear(m); // Give back memory to system +*/ // NOTE: Can not use m-list since it may be expanded from LIST_DEF // FIXME: Shall this use standard memory function (malloc) or M_MEMORY_ALLOC? -#define MEMPOOLI_MAX_PER_SEGMENT(type) M_MAX(16*1024 / sizeof (type), 256U) - #define MEMPOOL_DEF(name, type) \ \ typedef union M_C3(mempool_,name,_union_s) { \ @@ -125,4 +133,8 @@ mem->count--; \ } \ +/********************************** INTERNAL ************************************/ + +#define MEMPOOLI_MAX_PER_SEGMENT(type) M_MAX(16*1024 / sizeof (type), 256U) + #endif