|
libclod
C library for interacting with NBTs, region files, LOD data and other things.
|
Memory allocation methods. More...
#include <clod/lib.h>Go to the source code of this file.
Classes | |
| struct | clod_allocator |
| Allocator. More... | |
| struct | clod_allocator_opts |
| Configuration options for libclod's memory allocator. More... | |
Functions | |
| clod_allocator * | clod_allocator_create (const struct clod_allocator_opts *opts) |
| void | clod_allocator_destroy (clod_allocator *allocator) |
Memory allocation methods.
Definition in file memory.h.
| clod_allocator * clod_allocator_create | ( | const struct clod_allocator_opts * | opts | ) |
Create a memory allocator.
It is not thread safe. Instead, make a dedicated allocator for each thread, and if you need to free memory in a different thread from where it was allocated - fix your program architecture.
Allocations are aligned to either the power of two equal to or greater than size or the configured page size; whichever is smaller.
The contents of allocated memory is undefined.
Allocating a size of zero returns a non-null non-unique pointer that can be freed. Freeing nullptr does nothing.
| [in] | opts | (nullable) Allocator configuration options. |
| void clod_allocator_destroy | ( | clod_allocator * | allocator | ) |