#include <G4AllocatorPool.hh>
Public Member Functions | |
G4AllocatorPool (unsigned int n=0) | |
~G4AllocatorPool () | |
void * | Alloc () |
void | Free (void *b) |
unsigned int | Size () const |
void | Reset () |
int | GetNoPages () const |
unsigned int | GetPageSize () const |
void | GrowPageSize (unsigned int factor) |
Data Structures | |
class | G4PoolChunk |
struct | G4PoolLink |
Definition at line 50 of file G4AllocatorPool.hh.
G4AllocatorPool::G4AllocatorPool | ( | unsigned int | n = 0 |
) | [explicit] |
Definition at line 44 of file G4AllocatorPool.cc.
00045 : esize(sz<sizeof(G4PoolLink) ? sizeof(G4PoolLink) : sz), 00046 csize(sz<1024/2-16 ? 1024-16 : sz*10-16), 00047 chunks(0), head(0), nchunks(0) 00048 { 00049 }
G4AllocatorPool::~G4AllocatorPool | ( | ) |
void * G4AllocatorPool::Alloc | ( | ) | [inline] |
Definition at line 119 of file G4AllocatorPool.hh.
Referenced by G4Allocator< Type >::MallocSingle().
00120 { 00121 if (head==0) { Grow(); } 00122 G4PoolLink* p = head; // return first element 00123 head = p->next; 00124 return p; 00125 }
void G4AllocatorPool::Free | ( | void * | b | ) | [inline] |
Definition at line 132 of file G4AllocatorPool.hh.
Referenced by G4Allocator< Type >::FreeSingle().
00133 { 00134 G4PoolLink* p = static_cast<G4PoolLink*>(b); 00135 p->next = head; // put b back as first element 00136 head = p; 00137 }
int G4AllocatorPool::GetNoPages | ( | ) | const [inline] |
unsigned int G4AllocatorPool::GetPageSize | ( | ) | const [inline] |
Definition at line 164 of file G4AllocatorPool.hh.
Referenced by G4Allocator< Type >::GetPageSize().
void G4AllocatorPool::GrowPageSize | ( | unsigned int | factor | ) | [inline] |
Definition at line 174 of file G4AllocatorPool.hh.
Referenced by G4Allocator< Type >::IncreasePageSize().
void G4AllocatorPool::Reset | ( | ) |
Definition at line 88 of file G4AllocatorPool.cc.
References CLHEP::detail::n.
Referenced by G4Allocator< Type >::ResetStorage(), and ~G4AllocatorPool().
00089 { 00090 // Free all chunks 00091 // 00092 G4PoolChunk* n = chunks; 00093 G4PoolChunk* p = 0; 00094 while (n) 00095 { 00096 p = n; 00097 n = n->next; 00098 delete p; 00099 } 00100 head = 0; 00101 chunks = 0; 00102 nchunks = 0; 00103 }
unsigned int G4AllocatorPool::Size | ( | ) | const [inline] |
Definition at line 144 of file G4AllocatorPool.hh.
Referenced by G4Allocator< Type >::GetAllocatedSize().