docs/Writerside/topics/memory.md

Sat, 08 Feb 2025 14:24:22 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 08 Feb 2025 14:24:22 +0100
branch
docs/3.1
changeset 1170
49cc0bbea6a9
parent 1141
a06a2d27c043
permissions
-rw-r--r--

add Memory Management Section description

relates to #451

1141
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 # Memory Management
1170
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
2
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
3 With the `CxAllocator` interface UCX provides the possibility to use custom allocator functions for different purposes.
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
4 Many UCX functions support the use of specialized allocators or provide a second function suffixed with `_a`.
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
5
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
6 For convenience, functions that are not explicitly requesting an allocator - like e.g. `cx_strdup_a()` - also accept
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
7 `NULL` as an allocator, in which case the `cxDefaultAllocator` and stdlib functions are used.
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
8
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
9 Additionally, UCX also provides a [memory pool](mempool.h.md) implementation of the allocator interface.
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
10
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
11 > Although not part of the public API, UCX is also implementing the allocator interface
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
12 > in its own test suite: `CxTestingAllocator`. This allocator keeps track of memory allocations
49cc0bbea6a9 add Memory Management Section description
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
13 > and de-allocations with the goal to detect memory management errors.

mercurial