|
CookMem 1.4.0
A C++ memory context / allocator
|
#include <arena.h>
Public Member Functions | |
| FixedArena (void *ptr, std::size_t size) | |
| void * | getSegment (std::size_t &size) |
| bool | freeSegment (void *ptr, std::size_t size) |
| void | releaseAll () |
This memory arena simply wraps around a piece of memory which is used for memory allocation.
This class implements the interface of MemArena without explicitly inheriting from it. This is to avoid the overhead of virtual function calls and allows inlining of the functions.
|
inline |
Constructor.
| ptr | the memory buffer for memory allocation. If it is not aligned to ALLOCATION_ALIGNMENT, the start address is advanced to the next aligned address. |
| size | The size of the memory buffer. The usable size is reduced by any bytes skipped to align the start address, then rounded down to a multiple of ALLOCATION_ALIGNMENT. |
Free an arena segment.
| ptr | the pointer to be freed. |
| size | the size of the pointer. |
|
inline |
Allocate an arena segment.
| [in,out] | size | the size of the page. This value is updated upon successful request to indicate the actual size obtained. |
|
inline |
Release all segments held by this arena. The buffer belongs to the caller, so this function does nothing.