#include <pool.h>
Public Member Functions | |
| Pool (size_t a, size_t d) | |
| Creates a Pool for units of d_alignSize = max(a, machine word size) bytes. | |
| ~Pool () | |
| Return the memory to the system. | |
| size_t | maxAlloc () const |
| size_t | instance () const |
| void * | allocate (size_t) |
| void | deallocate (void *, size_t) |
Static Public Member Functions | |
| void | allowReport () |
| size_t | numInstances () |
| void | memoryReport () |
| Writes a report on the various pool constructions and destructions in the memory log file. | |
Private Member Functions | |
| void * | newBlock (size_t m) |
| Allocates a new block for a memory request of 2^m units of size max(d_atomSize,sizeof(MemBlock*)). | |
| void | reportDestruction () |
| Writes down data about the memory usage of the pool. | |
Private Attributes | |
| const size_t | d_atomSize |
| Size in machine words of each object stored in this Pool. | |
| const size_t | d_defaultRequest |
| Each system memory request is of size (2^d_defaultRequest)(d_alignSize) machine words. | |
| const size_t | d_maxAlloc |
| const size_t | d_alignSize |
| const size_t | d_instance |
| Which instance of Pool this is. | |
| void * | d_free [constants::sizeBits] |
| Entry m (for 0 <= m < word size) is a pointer to the first free block of 2^m units of memory in the Pool. | |
| size_t | d_used [constants::sizeBits] |
| Entry m (for 0 <= m < word size) tells how many blocks of 2^m units of memory have been assigned by this Pool. | |
| size_t | d_allocated [constants::sizeBits] |
| Entry m (for 0 <= m < word size) tells how many blocks of 2^m units of memory have been prepared for use by this Pool. | |
| std::vector< void * > | d_systemAllocs |
| Entry #j is a pointer to the beginning of the jth block (of size (d_Size)(2^d_defaultRequest)) assigned by the system to this Pool. | |
Static Private Attributes | |
| size_t | instances = 0 |
| Incremented each time Pool is instantiated, and decremented when a Pool is destroyed, so that it counts the number of Pool's. | |
| size_t | constructions = 0 |
| Incremented each time Pool is instantiated, but not decremented when a Pool is destroyed. | |
| const char * | logfile = "pool.log" |
| Report on the activity of Pool. | |
| bool | done = false |
|
||||||||||||
|
Creates a Pool for units of d_alignSize = max(a, machine word size) bytes.
Definition at line 129 of file pool.cpp. References d_allocated, d_free, d_used, and atlas::constants::sizeBits. |
|
|
Return the memory to the system.
Definition at line 151 of file pool.cpp. References d_systemAllocs, instances, and memoryReport(). |
|
|
Definition at line 172 of file pool.cpp. References d_atomSize, d_free, atlas::pool::helper::MemBlock::d_next, d_used, atlas::bits::lastBit(), newBlock(), and atlas::pool::helper::reducedSize(). |
|
|
|
|
||||||||||||
|
Definition at line 199 of file pool.cpp. References d_atomSize, d_free, atlas::pool::helper::MemBlock::d_next, d_used, atlas::bits::lastBit(), and atlas::pool::helper::reducedSize(). |
|
|
|
|
|
|
|
|
Writes a report on the various pool constructions and destructions in the memory log file.
Definition at line 228 of file pool.cpp. References atlas::pool::helper::PoolDestruct::d_allocated, atlas::pool::helper::PoolDestruct::d_instance, atlas::pool::helper::PoolDestruct::d_systemAllocs, logfile, atlas::pool::helper::poolDestructions, and atlas::constants::sizeBits. Referenced by ~Pool(). |
|
|
Allocates a new block for a memory request of 2^m units of size max(d_atomSize,sizeof(MemBlock*)).
Definition at line 264 of file pool.cpp. References d_alignSize, d_allocated, d_defaultRequest, d_free, atlas::pool::helper::MemBlock::d_next, and d_systemAllocs. Referenced by allocate(). |
|
|
|
|
|
Writes down data about the memory usage of the pool.
Definition at line 340 of file pool.cpp. References d_allocated, atlas::pool::helper::PoolDestruct::d_allocated, atlas::pool::helper::PoolDestruct::d_instance, d_systemAllocs, atlas::pool::helper::PoolDestruct::d_systemAllocs, atlas::pool::helper::poolDestructions, and atlas::constants::sizeBits. |
|
|
Incremented each time Pool is instantiated, but not decremented when a Pool is destroyed.
|
|
|
Definition at line 98 of file pool.h. Referenced by newBlock(). |
|
|
Entry m (for 0 <= m < word size) tells how many blocks of 2^m units of memory have been prepared for use by this Pool.
Definition at line 121 of file pool.h. Referenced by newBlock(), Pool(), and reportDestruction(). |
|
|
Size in machine words of each object stored in this Pool.
Definition at line 86 of file pool.h. Referenced by allocate(), and deallocate(). |
|
|
Each system memory request is of size (2^d_defaultRequest)(d_alignSize) machine words.
Definition at line 92 of file pool.h. Referenced by newBlock(). |
|
|
Entry m (for 0 <= m < word size) is a pointer to the first free block of 2^m units of memory in the Pool.
Definition at line 109 of file pool.h. Referenced by allocate(), deallocate(), newBlock(), and Pool(). |
|
|
Which instance of Pool this is.
|
|
|
|
|
|
Entry #j is a pointer to the beginning of the jth block (of size (d_Size)(2^d_defaultRequest)) assigned by the system to this Pool. Each assignment is of (d_alignSize)(2^m) bytes, for some m >= d_defaultRequest. Definition at line 131 of file pool.h. Referenced by newBlock(), reportDestruction(), and ~Pool(). |
|
|
Entry m (for 0 <= m < word size) tells how many blocks of 2^m units of memory have been assigned by this Pool.
Definition at line 115 of file pool.h. Referenced by allocate(), deallocate(), and Pool(). |
|
|
|
|
|
Incremented each time Pool is instantiated, and decremented when a Pool is destroyed, so that it counts the number of Pool's.
Definition at line 35 of file pool.cpp. Referenced by ~Pool(). |
|
|
Report on the activity of Pool.
Definition at line 37 of file pool.cpp. Referenced by memoryReport(). |
1.3.9.1