CookMem 1.4.0
A C++ memory context / allocator
Loading...
Searching...
No Matches
cookmem::MemArena Class Referenceabstract

#include <arena.h>

Public Member Functions

virtual void * getSegment (std::size_t &size)=0
 
virtual bool freeSegment (void *ptr, std::size_t size)=0
 
virtual void releaseAll ()=0
 

Detailed Description

An arena is used to retrieve a page of memory.

This class here is merely to define the interface needed to implement a MemArena.

Member Function Documentation

◆ freeSegment()

virtual bool cookmem::MemArena::freeSegment ( void *  ptr,
std::size_t  size 
)
pure virtual

Free an arena segment.

Parameters
ptrthe pointer to be freed.
sizethe size of the pointer.
Returns
true if there is an error. false is okay.

◆ getSegment()

virtual void * cookmem::MemArena::getSegment ( std::size_t &  size)
pure virtual

Allocate an arena segment.

Parameters
[in,out]sizethe size of the page. This value is updated upon successful request to indicate the actual size obtained.
Returns
the allocated pointer. nullptr is allocation failed.

◆ releaseAll()

virtual void cookmem::MemArena::releaseAll ( )
pure virtual

Release all segments held by this arena. Segments that a memory pool is still using are not affected. An arena that keeps no segments does nothing.


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