UMPIRE
Umpire: resource management and provision
umpire::alloc::PosixMemalignAllocator Struct Reference

Uses posix_memalign() and free() to allocate page-aligned memory. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/alloc/PosixMemalignAllocator.hpp>

Public Member Functions

void * allocate (std::size_t bytes)
 Allocate bytes of memory using posix_memalign. More...
 
void deallocate (void *ptr)
 Deallocate memory using free. More...
 
bool isAccessible (Platform p)
 

Detailed Description

Uses posix_memalign() and free() to allocate page-aligned memory.

Member Function Documentation

◆ allocate()

void* umpire::alloc::PosixMemalignAllocator::allocate ( std::size_t  bytes)
inline

Allocate bytes of memory using posix_memalign.

Parameters
bytesNumber of bytes to allocate. Does not have to be a multiple of the system page size.
Returns
Pointer to start of the allocation.
Exceptions
umpire::util::runtime_errorif memory cannot be allocated.

References umpire::util::message::Debug, umpire::get_page_size(), UMPIRE_ERROR, and UMPIRE_LOG.

◆ deallocate()

void umpire::alloc::PosixMemalignAllocator::deallocate ( void *  ptr)
inline

Deallocate memory using free.

Parameters
ptrAddress to deallocate.
Exceptions
umpire::util::runtime_errorif memory cannot be free'd.

References umpire::util::message::Debug, umpire::free(), and UMPIRE_LOG.

◆ isAccessible()

bool umpire::alloc::PosixMemalignAllocator::isAccessible ( Platform  p)
inline