Fix documentation and usage of 2nd argument to mp_pool_new.
svn:r9942
}
/** Allocate a new memory pool to hold items of size <b>item_size</b>. We'll
- * try to fit about <b>chunk_capacity</b> items in each chunk. */
+ * try to fit about <b>chunk_capacity</b> bytes in each chunk. */
mp_pool_t *
mp_pool_new(size_t item_size, size_t chunk_capacity)
{
void *mp_pool_get(mp_pool_t *pool);
void mp_pool_release(void *item);
-mp_pool_t *mp_pool_new(size_t item_size, unsigned int n_per_chunk);
+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);
init_cell_pool(void)
{
tor_assert(!cell_pool);
- cell_pool = mp_pool_new(sizeof(packed_cell_t), 64);
+ cell_pool = mp_pool_new(sizeof(packed_cell_t), 1<<19);
}
/** Free all storage used to hold cells. */
test_assert(pool->item_alloc_size >= sizeof(void*)+1);
mp_pool_destroy(pool);
- pool = mp_pool_new(241, 10);
+ pool = mp_pool_new(241, 2500);
test_assert(pool->new_chunk_capacity >= 10);
test_assert(pool->item_alloc_size >= sizeof(void*)+241);
test_eq(pool->item_alloc_size & 0x03, 0);