|
libclod
C library for interacting with NBTs, region files, LOD data and other things.
|
Allocator. More...
#include <memory.h>
Public Attributes | |
| void * | self |
Value passed to invocations of allocate and free. | |
| void *(* | allocate )(size_t size, void *self) |
| void(* | free )(void *ptr, void *self) |
| uint32_t | checksum |
| Checksum. | |
| uint32_t | size |
| Size of backing memory. | |
| clod_allocator * | next |
| block_ptr | last_slab_branch [13] |
| struct node | free |
| struct node | used |
Allocator.
Memory allocator methods. Libclod provides a way to create an allocator built using system virtual memory. Methods that take an allocator for internal usage do not assume the implementation is libclod's. As such, custom allocations methods can be provided everywhere clod_allocator is used unless stated otherwise.
| void* clod_allocator::self |
| void(* clod_allocator::free) (void *ptr, void *self) |
| uint32_t clod_allocator::checksum |
Checksum.
Definition at line 170 of file allocator.h.
| uint32_t clod_allocator::size |
Size of backing memory.
Definition at line 173 of file allocator.h.
| clod_allocator* clod_allocator::next |
The allocator may need to create more than one backing memory instance. This forms a circular linked list between all of them.
Definition at line 177 of file allocator.h.
| block_ptr clod_allocator::last_slab_branch[13] |
Pointer to the tree branch containing the slab that was most recently used to fulfill an allocation. Allows repeated slab-sized allocations to (usually) quickly find a slab with free space instead of searching the used tree.
They should not blindly be used, as the tree may have been restructured. So the usual checks as done when searching the used tree for slabs should still be performed.
Definition at line 186 of file allocator.h.
| struct node clod_allocator::free |
Definition at line 188 of file allocator.h.
| struct node clod_allocator::used |
Definition at line 189 of file allocator.h.