#include <lockedpool.h>
Definition at line 48 of file 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.
Definition at line 90 of file lockedpool.h.
◆ 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.
Definition at line 51 of file lockedpool.cpp.
◆ 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.
Definition at line 87 of file lockedpool.cpp.
◆ operator=()
◆ stats()
◆ alignment
◆ base
◆ chunks_free
Map from begin of free chunk to its node in size_to_free_chunk.
Definition at line 98 of file lockedpool.h.
◆ chunks_free_end
Map from end of free chunk to its node in size_to_free_chunk.
Definition at line 100 of file lockedpool.h.
◆ chunks_used
std::unordered_map<void*, size_t> Arena::chunks_used |
|
private |
Map from begin of used chunk to its size.
Definition at line 103 of file lockedpool.h.
◆ end
◆ size_to_free_chunk
Map to enable O(log(n)) best-fit allocation, as it's sorted by size.
Definition at line 94 of file lockedpool.h.
The documentation for this class was generated from the following files: