|
Macaulay2 Engine
|
Thin RAII wrapper around memtailor::Arena providing bump-pointer array allocation with optional mutex protection. More...
#include <MemoryBlock.hpp>
Public Member Functions | |
| MemoryBlock () | |
| ~MemoryBlock () | |
| template<typename T> | |
| std::pair< T *, T * > | allocateArray (size_t nelems) |
| template<typename T, typename MutexType> | |
| std::pair< T *, T * > | safeAllocateArray (size_t nelems, MutexType &mutex) |
| template<typename T> | |
| std::pair< T *, T * > | shrinkLastAllocate (T *begin, T *end, T *newtop) |
| template<typename T> | |
| void | freeTopArray (T *begin, T *end) |
| void | deallocateAll () |
| void | swap (MemoryBlock &source) |
| size_t | getMemoryUsedInBytes () |
Private Attributes | |
| memt::Arena * | mArena |
Thin RAII wrapper around memtailor::Arena providing bump-pointer array allocation with optional mutex protection.
Heap-allocates the underlying memt::Arena so the wrapper has a stable address (the std::move overloads are kept commented out as a reminder that move semantics aren't currently supported). allocateArray<T>(n) hands out a [begin, end) pair pulled from the arena; safeAllocateArray does the same under a caller-supplied mutex for use from NCF4 / NCGroebner worker threads. The arena is reset by destruction; individual frees are not supported by design.
Definition at line 56 of file MemoryBlock.hpp.