|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Memory arena for fast bulk allocations. More...
#include <cstdlib>#include <cstddef>#include <utility>#include <new>#include <aleph.H>#include <ah-errors.H>Go to the source code of this file.
Classes | |
| class | Aleph::AhArenaAllocator |
| Arena allocator for fast bump-pointer allocation. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Functions | |
| template<class T , typename... Args> | |
| T * | Aleph::allocate (AhArenaAllocator &arena, Args &&... args) |
| Allocate and construct an object in an arena. | |
| template<class T > | |
| void | Aleph::deallocate (AhArenaAllocator &arena, T *ptr) noexcept |
| Destruct and deallocate an object from an arena. | |
| template<class T > | |
| void | Aleph::dealloc (AhArenaAllocator &arena, T *ptr) noexcept |
| Alias for deallocate (backward compatibility). | |
Memory arena for fast bulk allocations.
Provides an arena allocator that allocates memory using bump-pointer allocation, enabling O(1) allocations with minimal fragmentation. Memory is freed all at once when the arena is destroyed or reset.
Arena allocators (also known as region-based allocators) are useful when:
This allocator is not thread-safe. For multi-threaded applications, use one arena per thread or add external synchronization.
Definition in file ah-arena.H.