--- a/src/cx/mempool.h Fri Apr 11 09:15:21 2025 +0200 +++ b/src/cx/mempool.h Fri Apr 11 13:20:07 2025 +0200 @@ -156,6 +156,26 @@ cx_destructor_func destr ); +/** + * Transfers all the memory managed by one pool to another. + * + * The allocator of the source pool will also be transferred and registered with the destination pool + * and stays valid, as long as the destination pool is not destroyed. + * + * The source pool will get a completely new allocator and can be reused or destroyed afterward. + * + * @param source the pool to move the memory from + * @param dest the pool where to transfer the memory to + * @retval zero success + * @retval non-zero failure + */ +cx_attr_nonnull +cx_attr_export +int cxMempoolTransfer( + CxMempool *source, + CxMempool *dest +); + #ifdef __cplusplus } // extern "C" #endif