1#ifndef AMREX_DATA_ALLOCATOR_H_
2#define AMREX_DATA_ALLOCATOR_H_
3#include <AMReX_Config.H>
31 [[nodiscard]]
void*
alloc (std::size_t sz)
const noexcept {
36 void free (
void* pt)
const noexcept {
Memory arena base class and global arena accessors.
Abstract base class for memory arenas.
Definition AMReX_Arena.H:153
virtual void free(void *pt)=0
Free a previously allocated block pointed to by pt.
virtual void * alloc(std::size_t sz)=0
Allocate sz bytes from this arena.
Arena * The_Arena()
Definition AMReX_Arena.cpp:820
Definition AMReX_Amr.cpp:50
Lightweight allocator/deallocator backed by an Arena.
Definition AMReX_DataAllocator.H:21
void * alloc(std::size_t sz) const noexcept
Allocate sz bytes from the arena.
Definition AMReX_DataAllocator.H:31
DataAllocator() noexcept=default
Default-construct; alloc/free will use The_Arena().
Arena * arena() const noexcept
Return the stored arena, or The_Arena() if none was set.
Definition AMReX_DataAllocator.H:41
void free(void *pt) const noexcept
Return the allocation at pt to the arena.
Definition AMReX_DataAllocator.H:36
Arena * m_arena
Stored arena pointer (may be null).
Definition AMReX_DataAllocator.H:22
Custom deleter that returns memory to an Arena.
Definition AMReX_DataAllocator.H:53
DataDeleter() noexcept=default
Default-construct; operator() will use The_Arena().
void operator()(void *pt) const noexcept
Return the allocation at pt to the arena.
Definition AMReX_DataAllocator.H:62
Arena * m_arena
Definition AMReX_DataAllocator.H:54
Arena * arena() const noexcept
Return the stored arena, or The_Arena() if none was set.
Definition AMReX_DataAllocator.H:60