1*76404edcSAsim Jamshed #ifndef __MEMORY_MGT_H_ 2*76404edcSAsim Jamshed #define __MEMORY_MGT_H_ 3*76404edcSAsim Jamshed 4*76404edcSAsim Jamshed struct mem_pool; 5*76404edcSAsim Jamshed typedef struct mem_pool* mem_pool_t; 6*76404edcSAsim Jamshed 7*76404edcSAsim Jamshed /* create a memory pool with a chunk size and total size 8*76404edcSAsim Jamshed an return the pointer to the memory pool */ 9*76404edcSAsim Jamshed mem_pool_t MPCreate(int chunk_size, size_t total_size, int is_hugepage); 10*76404edcSAsim Jamshed 11*76404edcSAsim Jamshed /* allocate one chunk */ 12*76404edcSAsim Jamshed void *MPAllocateChunk(mem_pool_t mp); 13*76404edcSAsim Jamshed 14*76404edcSAsim Jamshed /* free one chunk */ 15*76404edcSAsim Jamshed void MPFreeChunk(mem_pool_t mp, void *p); 16*76404edcSAsim Jamshed 17*76404edcSAsim Jamshed /* destroy the memory pool */ 18*76404edcSAsim Jamshed void MPDestroy(mem_pool_t mp); 19*76404edcSAsim Jamshed 20*76404edcSAsim Jamshed /* return the number of free chunks */ 21*76404edcSAsim Jamshed int MPGetFreeChunks(mem_pool_t mp); 22*76404edcSAsim Jamshed 23*76404edcSAsim Jamshed #endif /* __MEMORY_MGT_H_ */ 24