Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::IArena Class Referenceabstract

Memory arena interface. More...

#include <iarena.h>

Inheritance diagram for roc::core::IArena:

Public Member Functions

virtual void * allocate (size_t size)=0
 Allocate memory. More...
 
virtual void deallocate (void *ptr)=0
 Deallocate previously allocated memory. More...
 
virtual size_t compute_allocated_size (size_t size) const =0
 Computes how many bytes will be actually allocated if allocate() is called with given size. Covers all internal overhead, if any. More...
 
virtual size_t allocated_size (void *ptr) const =0
 Returns how many bytes was allocated for given pointer returned by allocate(). Covers all internal overhead, if any. Returns same value as computed by compute_allocated_size(size). More...
 
template<class T >
void destroy_object (T &object)
 Destroy object and deallocate its memory. More...
 

Detailed Description

Memory arena interface.

Definition at line 23 of file iarena.h.

Member Function Documentation

◆ allocate()

virtual void* roc::core::IArena::allocate ( size_t  size)
pure virtual

Allocate memory.

Returns
pointer to a maximum aligned uninitialized memory at least of size bytes or NULL if memory can't be allocated.

Implemented in roc::core::NoopArenaImpl, roc::core::LimitedArena, and roc::core::HeapArena.

◆ allocated_size()

virtual size_t roc::core::IArena::allocated_size ( void *  ptr) const
pure virtual

Returns how many bytes was allocated for given pointer returned by allocate(). Covers all internal overhead, if any. Returns same value as computed by compute_allocated_size(size).

Implemented in roc::core::NoopArenaImpl, roc::core::LimitedArena, and roc::core::HeapArena.

◆ compute_allocated_size()

virtual size_t roc::core::IArena::compute_allocated_size ( size_t  size) const
pure virtual

Computes how many bytes will be actually allocated if allocate() is called with given size. Covers all internal overhead, if any.

Implemented in roc::core::NoopArenaImpl, roc::core::LimitedArena, and roc::core::HeapArena.

◆ deallocate()

virtual void roc::core::IArena::deallocate ( void *  ptr)
pure virtual

Deallocate previously allocated memory.

Implemented in roc::core::NoopArenaImpl, roc::core::LimitedArena, and roc::core::HeapArena.

◆ destroy_object()

template<class T >
void roc::core::IArena::destroy_object ( T &  object)
inline

Destroy object and deallocate its memory.

Definition at line 46 of file iarena.h.


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