Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <lockedpool.h>
Inheritance diagram for Arena:Classes | |
| struct | Stats |
| Memory statistics. More... | |
Public Member Functions | |
| Arena (void *base, size_t size, size_t alignment) | |
| virtual | ~Arena () |
| Arena (const Arena &other)=delete | |
| Arena & | operator= (const Arena &)=delete |
| void * | alloc (size_t size) |
| Allocate size bytes from this arena. More... | |
| void | free (void *ptr) |
| Free a previously allocated chunk of memory. More... | |
| Stats | stats () const |
| Get arena usage statistics. More... | |
| bool | addressInArena (void *ptr) const |
| Return whether a pointer points inside this arena. More... | |
Private Attributes | |
| std::map< char *, size_t > | chunks_free |
| Map of chunk address to chunk information. More... | |
| std::map< char *, size_t > | chunks_used |
| char * | base |
| Base address of arena. More... | |
| char * | end |
| End address of arena. More... | |
| size_t | alignment |
| Minimum chunk alignment. More... | |
Detailed Description
Definition at line 47 of file lockedpool.h.
Constructor & Destructor Documentation
◆ Arena() [1/2]
| Arena::Arena | ( | void * | base, |
| size_t | size, | ||
| size_t | alignment | ||
| ) |
Definition at line 47 of file lockedpool.cpp.
References base, and chunks_free.
◆ ~Arena()
|
virtual |
Definition at line 54 of file lockedpool.cpp.
◆ Arena() [2/2]
|
delete |
Member Function Documentation
◆ addressInArena()
|
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 89 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 58 of file lockedpool.cpp.
References align_up(), alignment, chunks_free, and chunks_used.
Referenced by BenchLockedPool().
◆ 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 89 of file lockedpool.cpp.
References chunks_free, chunks_used, and extend().
Referenced by BenchLockedPool().
◆ operator=()
◆ stats()
| Arena::Stats Arena::stats | ( | ) | const |
Get arena usage statistics.
Definition at line 113 of file lockedpool.cpp.
References chunks_free, and chunks_used.
Member Data Documentation
◆ alignment
|
private |
◆ base
|
private |
Base address of arena.
Definition at line 97 of file lockedpool.h.
Referenced by addressInArena(), and Arena().
◆ chunks_free
|
private |
◆ chunks_used
|
private |
Definition at line 95 of file lockedpool.h.
◆ end
|
private |
The documentation for this class was generated from the following files:
- src/support/lockedpool.h
- src/support/lockedpool.cpp

