1.1 --- a/ucx/mempool.h Mon Mar 06 15:37:40 2017 +0100 1.2 +++ b/ucx/mempool.h Mon Mar 06 16:09:42 2017 +0100 1.3 @@ -70,39 +70,29 @@ 1.4 /** 1.5 * Creates a memory pool with the specified initial size. 1.6 * 1.7 - * As the created memory pool automatically grows in size by 16 elements, when 1.8 + * As the created memory pool automatically grows in size by factor two when 1.9 * trying to allocate memory on a full pool, it is recommended that you use 1.10 - * a multiple of 16 for the initial size. 1.11 + * a power of two for the initial size. 1.12 * 1.13 - * @param n initial pool size (should be a multiple of 16) 1.14 + * @param n initial pool size (should be a power of two, e.g. 16) 1.15 * @return a pointer to the new memory pool 1.16 + * @see ucx_mempool_new_default() 1.17 */ 1.18 UcxMempool *ucx_mempool_new(size_t n); 1.19 1.20 /** 1.21 * Resizes a memory pool. 1.22 * 1.23 + * This function will fail if the new capacity is not sufficient for the 1.24 + * present data. 1.25 + * 1.26 * @param pool the pool to resize 1.27 * @param newcap the new capacity 1.28 - * @return <code>EXIT_SUCCESS</code> on success or 1.29 - * <code>EXIT_FAILURE</code> on failure 1.30 + * @return zero on success or non-zero on failure 1.31 */ 1.32 int ucx_mempool_chcap(UcxMempool *pool, size_t newcap); 1.33 1.34 /** 1.35 - * Changes the pool size to the next smallest multiple of 16. 1.36 - * 1.37 - * You may use this macro, to reduce the pool size after freeing 1.38 - * many pooled memory items. 1.39 - * 1.40 - * @param pool the pool to clamp 1.41 - * @return <code>EXIT_SUCCESS</code> on success or 1.42 - * <code>EXIT_FAILURE</code> on failure 1.43 - */ 1.44 -#define ucx_mempool_clamp(pool) ucx_mempool_chcap(pool, \ 1.45 - (pool->ndata & ~0xF)+0x10) 1.46 - 1.47 -/** 1.48 * Allocates pooled memory. 1.49 * 1.50 * @param pool the memory pool 1.51 @@ -145,7 +135,7 @@ 1.52 * is called. 1.53 * 1.54 * If you specify memory, that is not pooled by the specified memory pool, the 1.55 - * behavior is undefined. 1.56 + * program will terminate with a call to <code>abort()</code>. 1.57 * 1.58 * @param pool the memory pool 1.59 * @param ptr a pointer to the memory that shall be freed