#include <GaudiKernel/AllocatorPool.h>
Allocator pool. Class is imported from Geant4 project
- Date
- 2006-02-14
Definition at line 72 of file AllocatorPool.h.
◆ AllocatorPool() [1/2]
GaudiUtils::AllocatorPool::AllocatorPool |
( |
unsigned int |
n = 0 | ) |
|
|
explicit |
Create a pool of elements of size n.
Definition at line 59 of file AllocatorPool.cpp.
60 :
esize( sz <
sizeof( PoolLink ) ?
sizeof( PoolLink ) : sz )
61 ,
csize( sz < 1024 / 2 - 16 ? 1024 - 16 : sz * 10 - 16 ) {}
◆ ~AllocatorPool()
GaudiUtils::AllocatorPool::~AllocatorPool |
( |
| ) |
|
◆ AllocatorPool() [2/2]
GaudiUtils::AllocatorPool::AllocatorPool |
( |
const AllocatorPool & |
right | ) |
|
◆ Alloc()
void * GaudiUtils::AllocatorPool::Alloc |
( |
| ) |
|
|
inline |
◆ Free()
void GaudiUtils::AllocatorPool::Free |
( |
void * |
b | ) |
|
|
inline |
Return an element back to the pool.
Definition at line 133 of file AllocatorPool.h.
134 PoolLink* p =
static_cast<PoolLink*
>( b );
◆ Grow()
void GaudiUtils::AllocatorPool::Grow |
( |
| ) |
|
|
private |
Make pool larger.
Definition at line 112 of file AllocatorPool.cpp.
116 auto n =
new PoolChunk(
csize );
122 char*
start =
n->mem.get();
124 for (
char* p =
start; p < last; p +=
esize ) {
125 reinterpret_cast<PoolLink*
>( p )->next =
reinterpret_cast<PoolLink*
>( p +
esize );
127 reinterpret_cast<PoolLink*
>( last )->next =
nullptr;
128 head =
reinterpret_cast<PoolLink*
>(
start );
◆ operator=()
Private equality operator.
Definition at line 75 of file AllocatorPool.cpp.
76 if ( &right ==
this ) {
return *
this; }
◆ Reset()
void GaudiUtils::AllocatorPool::Reset |
( |
| ) |
|
Return storage to the free store.
Definition at line 93 of file AllocatorPool.cpp.
97 PoolChunk* p =
nullptr;
◆ Size()
unsigned int GaudiUtils::AllocatorPool::Size |
( |
| ) |
const |
|
inline |
◆ chunks
PoolChunk* GaudiUtils::AllocatorPool::chunks = nullptr |
|
private |
◆ csize
const unsigned int GaudiUtils::AllocatorPool::csize |
|
private |
◆ esize
const unsigned int GaudiUtils::AllocatorPool::esize |
|
private |
◆ head
PoolLink* GaudiUtils::AllocatorPool::head = nullptr |
|
private |
◆ nchunks
int GaudiUtils::AllocatorPool::nchunks = 0 |
|
private |
The documentation for this class was generated from the following files: