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