]>
git.ipfire.org Git - thirdparty/git.git/blob - mem-pool.h
5 struct mp_block
*next_block
;
8 uintmax_t space
[FLEX_ARRAY
]; /* more */
12 struct mp_block
*mp_block
;
15 * The amount of available memory to grow the pool by.
16 * This size does not include the overhead for the mp_block.
20 /* The total amount of memory allocated by the pool. */
25 * Initialize mem_pool with specified initial size.
27 void mem_pool_init(struct mem_pool
**mem_pool
, size_t initial_size
);
30 * Discard a memory pool and free all the memory it is responsible for.
32 void mem_pool_discard(struct mem_pool
*mem_pool
);
35 * Alloc memory from the mem_pool.
37 void *mem_pool_alloc(struct mem_pool
*pool
, size_t len
);
40 * Allocate and zero memory from the memory pool.
42 void *mem_pool_calloc(struct mem_pool
*pool
, size_t count
, size_t size
);