#include <allocator.h>
Public Methods | |
Allocator (size_t unitSize=0) | |
Constructor. More... | |
~Allocator () | |
Destructor. | |
void * | get (size_t unitSize=0) |
Gets memory unit. More... | |
void | put (void *unit) |
Puts memory unit previously obtained by get() method back. More... | |
Private Types | |
enum | e { NUM_UNITS_IN_BLOCK = 50 } |
constants. More... | |
Private Methods | |
void | allocNewBlock () |
Allocates new block of units. | |
Private Attributes | |
void * | _freeUnits |
list of free units. | |
void * | _blocks |
list of allocated blocks. | |
size_t | _unitSize |
size of unit. |
This class serves for allocation of memory units of a fixed size specified during initialization. On average it should be faster than using the new() operator directly, because several units are allocated at once in one larger block. The allocator is used in conjunction with overloaded new() and delete() operators of a class to make frequent allocation of its instances more effective.
Definition at line 53 of file allocator.h.
|
constants.
Definition at line 56 of file allocator.h. |
|
Constructor.
Definition at line 79 of file allocator.h. |
|
|
Puts memory unit previously obtained by get() method back.
Definition at line 52 of file allocator.cpp. Referenced by TraceFrame::deleteArray(), Thread::operator delete(), ObjectTable::operator delete(), MonTrace::operator delete(), MonThreadTrace::operator delete(), MonThreadMethod::operator delete(), Method::operator delete(), IProf::sID::operator delete(), GC::operator delete(), CpuTrace::operator delete(), CpuThreadTrace::operator delete(), CpuThreadMethod::operator delete(), ClassField::operator delete(), Class::operator delete(), AllocTrace::operator delete(), AllocThreadTrace::operator delete(), AllocThreadObjectTrace::operator delete(), AllocThreadObjectMethod::operator delete(), AllocThreadObject::operator delete(), AllocThreadMethod::operator delete(), AllocObjectTrace::operator delete(), AllocObjectMethod::operator delete(), AllocObject::operator delete(), AllocInstance::operator delete(), AllocGlobalRef::operator delete(), and AllocArena::operator delete().
|