docs/Writerside/topics/memory.md

Wed, 21 Jan 2026 22:24:28 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 21 Jan 2026 22:24:28 +0100
changeset 1702
3f05e8f97b22
parent 1694
a2757c6427cc
permissions
-rw-r--r--

mempool.h - internalize structs that are not C++ compatible

relates to #799

# Memory Management

With the `CxAllocator` interface, UCX provides the possibility to use custom allocator functions for different purposes.
Many UCX functions support the use of specialized allocators or provide a second function suffixed with `_a`.

For convenience, functions that are not explicitly requesting an allocator - like e.g. `cx_strdup_a()` - also accept
`NULL` as an allocator, in which case the [default allocator](allocator.h.md#default-allocator) is used.

Additionally, UCX also provides a [memory pool](mempool.h.md) implementation of the allocator interface.

> Although not part of the public API, UCX is also implementing the allocator interface
> in its own test suite: `CxTestingAllocator`. This allocator keeps track of memory allocations
> and deallocations with the goal to detect memory management errors.  

mercurial