Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::LimitedArena Class Reference

Decorator around IArena to make it memory limited. More...

#include <limited_arena.h>

Inheritance diagram for roc::core::LimitedArena:
Collaboration diagram for roc::core::LimitedArena:

Public Member Functions

 LimitedArena (IArena &arena, MemoryLimiter &memory_limiter)
 Initialize. More...
 
virtual void * allocate (size_t size)
 Allocate memory after checking with the memory limiter. More...
 
virtual void deallocate (void *ptr)
 Deallocate previously allocated memory. More...
 
virtual size_t compute_allocated_size (size_t size) const
 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
 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...
 
- Public Member Functions inherited from roc::core::IArena
template<class T >
void destroy_object (T &object)
 Destroy object and deallocate its memory. More...
 

Detailed Description

Decorator around IArena to make it memory limited.

Definition at line 23 of file limited_arena.h.

Constructor & Destructor Documentation

◆ LimitedArena()

roc::core::LimitedArena::LimitedArena ( IArena arena,
MemoryLimiter memory_limiter 
)

Initialize.

Member Function Documentation

◆ allocate()

virtual void* roc::core::LimitedArena::allocate ( size_t  size)
virtual

Allocate memory after checking with the memory limiter.

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

Implements roc::core::IArena.

◆ allocated_size()

virtual size_t roc::core::LimitedArena::allocated_size ( void *  ptr) const
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).

Implements roc::core::IArena.

◆ compute_allocated_size()

virtual size_t roc::core::LimitedArena::compute_allocated_size ( size_t  size) const
virtual

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

Implements roc::core::IArena.

◆ deallocate()

virtual void roc::core::LimitedArena::deallocate ( void *  ptr)
virtual

Deallocate previously allocated memory.

Implements roc::core::IArena.


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