ucx/mempool.h

changeset 141
c466e2a6cbd0
parent 135
a0aa1c15f46b
child 146
aa376dba1ba8
     1.1 --- a/ucx/mempool.h	Tue Aug 13 14:20:12 2013 +0200
     1.2 +++ b/ucx/mempool.h	Wed Aug 14 13:13:36 2013 +0200
     1.3 @@ -92,6 +92,19 @@
     1.4  int ucx_mempool_chcap(UcxMempool *pool, size_t newcap);
     1.5  
     1.6  /**
     1.7 + * Changes the pool size to the next smallest multiple of 16.
     1.8 + * 
     1.9 + * You may use this macro, to reduce the pool size after freeing
    1.10 + * many pooled memory items.
    1.11 + * 
    1.12 + * @param pool the pool to clamp
    1.13 + * @return <code>EXIT_SUCCESS</code> on success or
    1.14 + * <code>EXIT_FAILURE</code> on failure
    1.15 + */
    1.16 +#define ucx_mempool_clamp(pool) ucx_mempool_chcap(pool, \
    1.17 +        (pool->ndata & ~0xF)+0x10)
    1.18 +
    1.19 +/**
    1.20   * Allocates pooled memory.
    1.21   * 
    1.22   * @param pool the memory pool
    1.23 @@ -115,6 +128,11 @@
    1.24  /**
    1.25   * Reallocates pooled memory.
    1.26   * 
    1.27 + * If the memory to be reallocated is not contained by the specified pool, this
    1.28 + * function will possibly fail. In case the memory had to be moved to another
    1.29 + * location, this function will print out a message to <code>stderr</code>
    1.30 + * and exit the program with error code <code>EXIT_FAILURE</code>.
    1.31 + * 
    1.32   * @param pool the memory pool
    1.33   * @param ptr a pointer to the memory that shall be reallocated
    1.34   * @param n the new size of the memory

mercurial