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 115 of file CoinAlloc.hpp.
| CoinAlloc::CoinAlloc | ( | ) |
| CoinAlloc::~CoinAlloc | ( | ) | [inline] |
Definition at line 122 of file CoinAlloc.hpp.
| void* CoinAlloc::alloc | ( | const std::size_t | n | ) | [inline] |
Definition at line 124 of file CoinAlloc.hpp.
| void CoinAlloc::dealloc | ( | void * | p | ) | [inline] |
Definition at line 145 of file CoinAlloc.hpp.
CoinMempool* CoinAlloc::pool_ [private] |
Definition at line 118 of file CoinAlloc.hpp.
int CoinAlloc::maxpooled_ [private] |
Definition at line 119 of file CoinAlloc.hpp.
1.6.3