CoinUtils 2.11.4
|
A memory pool allocator. More...
#include <CoinAlloc.hpp>
Public Member Functions | |
CoinAlloc () | |
~CoinAlloc () | |
void * | alloc (const std::size_t n) |
void | dealloc (void *p) |
Private Attributes | |
CoinMempool * | pool_ |
int | maxpooled_ |
A memory pool allocator.
If a request arrives for allocating n
bytes then it is first rounded up to the nearest multiple of sizeof(void*)
(this is n_roundup
), then one more sizeof(void*)
is added to this number. If the result is no more than maxpooled_ then the appropriate pool is used to get a chunk of memory, if not, then malloc is used. In either case, the size of the allocated chunk is written into the first sizeof(void*)
bytes and a pointer pointing afterwards is returned.
Definition at line 113 of file CoinAlloc.hpp.
CoinAlloc::CoinAlloc | ( | ) |
|
inline |
Definition at line 120 of file CoinAlloc.hpp.
|
inline |
Definition at line 122 of file CoinAlloc.hpp.
|
inline |
Definition at line 142 of file CoinAlloc.hpp.
|
private |
Definition at line 115 of file CoinAlloc.hpp.
|
private |
Definition at line 116 of file CoinAlloc.hpp.