Fermat
Public Methods | Public Members | List of all members
cugar::memory_arena Struct Reference

Detailed description

A simple memory pool, carving out space from a pre-allocated arena

#include <memory_arena.h>

Public Methods

CUGAR_HOST_DEVICE memory_arena (uint8 *_ptr=NULL)
 
CUGAR_HOST_DEVICE uint8 * byte_alloc (const uint64 sz, const uint64 alignment=1u)
 
template<typename T >
CUGAR_HOST_DEVICE T * alloc (const uint64 sz, const uint64 alignment=sizeof(T))
 

Public Members

uint8 * ptr
 
uint64 size
 

Constructor & Destructor Documentation

◆ memory_arena()

CUGAR_HOST_DEVICE cugar::memory_arena::memory_arena ( uint8 *  _ptr = NULL)
inline

constructor

Member Function Documentation

◆ alloc()

template<typename T >
CUGAR_HOST_DEVICE T* cugar::memory_arena::alloc ( const uint64  sz,
const uint64  alignment = sizeof(T) 
)
inline

typed-allocation

Parameters
szthe number of items to alloc
alignmentthe requested byte alignment

◆ byte_alloc()

CUGAR_HOST_DEVICE uint8* cugar::memory_arena::byte_alloc ( const uint64  sz,
const uint64  alignment = 1u 
)
inline

byte-allocation

Parameters
szthe number of bytes to alloc
alignmentthe requested byte alignment

The documentation for this struct was generated from the following file: