#include <lockedpool.h>
◆ ChunkToSizeMap
◆ SizeToChunkSortedMap
◆ Arena() [1/2]
Arena::Arena |
( |
void * |
base, |
|
|
size_t |
size, |
|
|
size_t |
alignment |
|
) |
| |
◆ ~Arena()
◆ Arena() [2/2]
Arena::Arena |
( |
const Arena & |
other | ) |
|
|
delete |
◆ addressInArena()
bool Arena::addressInArena |
( |
void * |
ptr | ) |
const |
|
inline |
Return whether a pointer points inside this arena. This returns base <= ptr < (base+size) so only use it for (inclusive) chunk starting addresses.
◆ alloc()
void * Arena::alloc |
( |
size_t |
size | ) |
|
Allocate size bytes from this arena. Returns pointer on success, or 0 if memory is full or the application tried to allocate 0 bytes.
◆ free()
void Arena::free |
( |
void * |
ptr | ) |
|
Free a previously allocated chunk of memory. Freeing the zero pointer has no effect. Raises std::runtime_error in case of error.
◆ operator=()
◆ stats()
Get arena usage statistics
◆ alignment
◆ base
◆ chunks_free
Map from begin of free chunk to its node in size_to_free_chunk
◆ chunks_free_end
Map from end of free chunk to its node in size_to_free_chunk
◆ chunks_used
std::unordered_map<char*, size_t> Arena::chunks_used |
|
private |
Map from begin of used chunk to its size
◆ end
◆ size_to_free_chunk
Map to enable O(log(n)) best-fit allocation, as it's sorted by size
The documentation for this class was generated from the following files: