CoinUtils 2.11.10
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CoinAlloc Class Reference

A memory pool allocator. More...

#include <CoinAlloc.hpp>

+ Collaboration diagram for CoinAlloc:

Public Member Functions

 CoinAlloc ()
 
 ~CoinAlloc ()
 
voidalloc (const std::size_t n)
 
void dealloc (void *p)
 

Private Attributes

CoinMempoolpool_
 
int maxpooled_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CoinAlloc()

CoinAlloc::CoinAlloc ( )

◆ ~CoinAlloc()

CoinAlloc::~CoinAlloc ( )
inline

Definition at line 120 of file CoinAlloc.hpp.

Member Function Documentation

◆ alloc()

void * CoinAlloc::alloc ( const std::size_t n)
inline

Definition at line 122 of file CoinAlloc.hpp.

◆ dealloc()

void CoinAlloc::dealloc ( void * p)
inline

Definition at line 142 of file CoinAlloc.hpp.

Member Data Documentation

◆ pool_

CoinMempool* CoinAlloc::pool_
private

Definition at line 115 of file CoinAlloc.hpp.

◆ maxpooled_

int CoinAlloc::maxpooled_
private

Definition at line 116 of file CoinAlloc.hpp.


The documentation for this class was generated from the following file: