Cuda battery library
Loading...
Searching...
No Matches
battery::pool_allocator Class Reference

#include <allocator.hpp>

Public Member Functions

CUDA NI pool_allocator ()=default
 
CUDA NI pool_allocator (const pool_allocator &other)
 
CUDA NI pool_allocator (pool_allocator &&other)
 
CUDA NI pool_allocator (unsigned char *mem, size_t capacity, size_t alignment=alignof(std::max_align_t))
 
CUDA NI ~pool_allocator ()
 
CUDA NI pool_allocatoroperator= (pool_allocator &&other)
 
CUDA size_t align_at (size_t alignment)
 
CUDA NI void * allocate (size_t bytes)
 
CUDA NI void deallocate (void *ptr)
 
CUDA NI void print () const
 
CUDA size_t used () const
 
CUDA size_t capacity () const
 
CUDA size_t num_deallocations () const
 
CUDA size_t num_allocations () const
 
CUDA size_t unaligned_wasted_bytes () const
 
CUDA bool operator== (const pool_allocator &rhs) const
 

Detailed Description

An allocator allocating memory from a pool of memory. The memory can for instance be the CUDA shared memory. This allocator is incomplete as it never frees the memory allocated. It allocates a control block using the "normal" operator new, where the address to the pool, its capacity and current offset are stored.

Constructor & Destructor Documentation

◆ pool_allocator() [1/4]

CUDA NI battery::pool_allocator::pool_allocator ( )
default

◆ pool_allocator() [2/4]

CUDA NI battery::pool_allocator::pool_allocator ( const pool_allocator & other)
inline

◆ pool_allocator() [3/4]

CUDA NI battery::pool_allocator::pool_allocator ( pool_allocator && other)
inline

◆ pool_allocator() [4/4]

CUDA NI battery::pool_allocator::pool_allocator ( unsigned char * mem,
size_t capacity,
size_t alignment = alignof(std::max_align_t) )
inline

◆ ~pool_allocator()

CUDA NI battery::pool_allocator::~pool_allocator ( )
inline

Member Function Documentation

◆ operator=()

CUDA NI pool_allocator & battery::pool_allocator::operator= ( pool_allocator && other)
inline

◆ align_at()

CUDA size_t battery::pool_allocator::align_at ( size_t alignment)
inline

◆ allocate()

CUDA NI void * battery::pool_allocator::allocate ( size_t bytes)
inline

◆ deallocate()

CUDA NI void battery::pool_allocator::deallocate ( void * ptr)
inline

◆ print()

CUDA NI void battery::pool_allocator::print ( ) const
inline

◆ used()

CUDA size_t battery::pool_allocator::used ( ) const
inline

◆ capacity()

CUDA size_t battery::pool_allocator::capacity ( ) const
inline

◆ num_deallocations()

CUDA size_t battery::pool_allocator::num_deallocations ( ) const
inline

◆ num_allocations()

CUDA size_t battery::pool_allocator::num_allocations ( ) const
inline

◆ unaligned_wasted_bytes()

CUDA size_t battery::pool_allocator::unaligned_wasted_bytes ( ) const
inline

◆ operator==()

CUDA bool battery::pool_allocator::operator== ( const pool_allocator & rhs) const
inline

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