123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #ifndef MEMPOOL_H
- #define MEMPOOL_H
- typedef struct mp_pool_t mp_pool_t;
- void *mp_pool_get(mp_pool_t *pool);
- void mp_pool_release(void *item);
- mp_pool_t *mp_pool_new(size_t item_size, size_t chunk_capacity);
- void mp_pool_clean(mp_pool_t *pool, int n);
- void mp_pool_destroy(mp_pool_t *pool);
- void mp_pool_assert_ok(mp_pool_t *pool);
- void mp_pool_log_status(mp_pool_t *pool, int severity);
- #ifdef MEMPOOL_PRIVATE
- struct mp_pool_t {
-
- struct mp_chunk_t *empty_chunks;
-
- struct mp_chunk_t *used_chunks;
-
- struct mp_chunk_t *full_chunks;
-
- int n_empty_chunks;
-
- int min_empty_chunks;
-
- int new_chunk_capacity;
-
- size_t item_alloc_size;
- };
- #endif
- #endif
|