diff -r a3e63cb21e20 -r 3dd7d21fb76b src/ucx/mempool.h
--- a/src/ucx/mempool.h Tue May 29 11:05:12 2018 +0200
+++ b/src/ucx/mempool.h Wed May 30 11:13:52 2018 +0200
@@ -164,6 +164,9 @@
*
* The destructor is automatically called when the memory is freed or the
* pool is destroyed.
+ * A destructor for pooled memory MUST NOT free the memory itself,
+ * as this is done by the pool. Use a destructor to free any resources
+ * managed by the pooled object.
*
* The only requirement for the specified memory is, that it MUST be
* pooled memory by a UcxMempool or an element-compatible mempool. The pointer
@@ -179,12 +182,18 @@
/**
* Registers a destructor function for the specified (non-pooled) memory.
- *
+ *
* This is useful, if you have memory that has not been allocated by a mempool,
* but shall be managed by a mempool.
*
* This function creates an entry in the specified mempool and the memory will
* therefore (logically) convert to pooled memory.
+ * However, this does not cause the memory to be freed automatically!.
+ * If you want to use this function, make the memory pool free non-pooled
+ * memory, the specified destructor function must call free()
+ * by itself. But keep in mind, that you then MUST NOT use this destructor
+ * function with pooled memory (e.g. in ucx_mempool_set_destr()), as it
+ * would cause a double-free.
*
* @param pool the memory pool
* @param ptr data the destructor is registered for