#include <lib/sconfig.h>
Include dependency graph for salloc.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Classes | |
struct | LMallocUsage |
Defines | |
#define | _SRC_SALLOC_H_ 1 |
Functions | |
void | LMallocGetUsage (struct LMallocUsage *dest) |
void | LMallocSetLimit (size_t limit) |
void | _AllocFailure (size_t size) |
Report allocation failure error and exit (internal). | |
void * | LMalloc (size_t size) |
Allocate some memory (internal). | |
void * | LFree (void *ptr) |
Free memory allocated via LMalloc (internal). | |
void * | LRealloc (void *ptr, size_t size) |
Resize memory allocated via LMalloc (internal). | |
template<typename T> T * | ALLOC (size_t nelem) |
Allocate array of PODs. | |
template<typename T> T * | FREE (T *ptr) |
Free array of PODs. | |
template<typename T> T * | REALLOC (T *ptr, size_t nelem) |
Re-allocate array of PODs. | |
void * | operator new (size_t size) |
Standard C++ allocation operator for single objects. | |
void * | operator new (size_t,void *ptr) |
C++ allocation operator for single objects with explicit placement. | |
void | operator delete (void *ptr) |
Standard C++ deallocation operator for single objects. | |
template<typename T> void | DELETE (T *&ptr) |
Improved version of operator delete. | |
void * | operator new[] (size_t size) |
Standard C++ allocation operator for arrays. | |
void | operator delete[] (void *ptr) |
Standard C++ deallocation operator for arrays. | |
template<typename T> void | DELARRAY (T *&ptr) |
Better version of operator delete[]. |
Definition in file salloc.h.
|
|
|
Report allocation failure error and exit (internal).
Definition at line 435 of file salloc.cc. References _LMallocExit(). Referenced by LMalloc(), and LRealloc(). |
|
Allocate array of PODs. Standard allocation and deallocation routines. NEVER USE malloc()/realloc()/free() directly. These templates for simple (POD) types like int, double, etc. which do not have a constructor. Use operator new[] for objects with constructor. Mostly used to allocate buffers (char*) and the like. Use FREE to free the memory again. Will abort on allocation failure.
Definition at line 134 of file salloc.h. References LMalloc(). |
|
Better version of operator delete[]. Better use this version of the delete[] operator than operator delete[] directly since this will also set the passed pointer to NULL (and only delete non-NULL arrays). Definition at line 269 of file salloc.h. Referenced by VM::NonResizeableArray< VTableEntry, uint32 >::_free(). |
|
Improved version of operator delete. Better use this version of the delete operator than operator delete directly since this will also set the passed pointer to NULL (and only delete non-NULL objects). Definition at line 235 of file salloc.h. Referenced by VM::VMLinker::_CreateInitFunction(), _InternalSourceFileNode::_DestroyPosCache(), VM::AssemblerFile_Plaintext::_ParseProgram_Label(), VM::AssemblerFile_Plaintext::_ParseSymbols_Class(), VM::AssemblerFile_Plaintext::_WriteFunctionProgram(), VM::VMLinker::LinkAll(), main(), _InternalFlexScannerBase::SetInput(), VM::AssemblerFile_Plaintext::WriteFile(), _InternalSourceFileNode::~_InternalSourceFileNode(), VM::AssemblerFile::~AssemblerFile(), VM::AssemblerFile_Plaintext::~AssemblerFile_Plaintext(), VM::VMLinker::FileNode::~FileNode(), and VM::VMLinker::~VMLinker(). |
|
Free array of PODs. Standard allocation and deallocation routines. NEVER USE malloc()/realloc()/free() directly. Free memory as allocated using ALLOC.
Definition at line 155 of file salloc.h. References LFree(). Referenced by _DoSortAndTest(), TLDynamicBitField< T >::_Free(), VM::VMLinker::_MergeNamespaceAndVTableInfo(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), MYOP< T >::free(), TLDefaultOperators_Allocation::free(), main(), VM::InstructionStorage::~InstructionStorage(), NUM::RandomNumberGenerator_LibCRandom::~RandomNumberGenerator_LibCRandom(), and TLString::SData::~SData(). |
|
Free memory allocated via LMalloc (internal).
For internal use only. These are the internal (de)allocation routines. Do not use these directly but use the below templates ALLOC, REALLOC, FREE instead. Free memory as allocated by LMalloc or LRealloc. If called with a NULL pointer, nothing is done.
Definition at line 453 of file salloc.cc. References _LFree(). Referenced by _LRealloc(), FREE(), LRealloc(), operator delete(), and operator delete[](). |
|
Allocate some memory (internal).
For internal use only. These are the internal (de)allocation routines. Do not use these directly but use the below templates ALLOC, REALLOC, FREE instead.
Definition at line 443 of file salloc.cc. References _AllocFailure(), and _LMalloc(). Referenced by _LRealloc(), ALLOC(), LRealloc(), operator new(), and operator new[](). |
|
Get the LMallocUsage; pass a pointer where to store the values: Definition at line 61 of file salloc.cc. References lmu. Referenced by main(). |
|
Allocation limitation feature: Sets memory usage limit (0 -> no limit) Definition at line 57 of file salloc.cc. References LMallocUsage::alloc_limit, and lmu. |
|
Resize memory allocated via LMalloc (internal).
For internal use only. These are the internal (de)allocation routines. Do not use these directly but use the below templates ALLOC, REALLOC, FREE instead. Re-allocate memory allocated by LMalloc, i.e. change the size of the memory region. A pointer to the new memory region is returned.
Definition at line 461 of file salloc.cc. References _AllocFailure(), _LRealloc(), LFree(), and LMalloc(). Referenced by REALLOC(). |
|
Standard C++ deallocation operator for single objects. Implementation of the (default) C++ deallocation operator for single objects (operator delete).
Definition at line 225 of file salloc.h. References LFree(). |
|
Standard C++ deallocation operator for arrays. Implementation of the (default) C++ deallocation operator for arrays (operator delete[]).
Definition at line 259 of file salloc.h. References LFree(). |
|
C++ allocation operator for single objects with explicit placement. This operator new can be used to "allocate" a object at the specified memory region. No real memory allocation will be performed by the operator. Actually, the standard operator new (without placement) can be "emulated" by this one as follows: A *obj=new A(x,y); // ...is just the same as... void *ptr=ALLOC<A>(1); // one element A *obj=new(ptr) A(x,y); // ...and just the same as... void *ptr=ALLOC<char>(sizeof(A)); A *obj=new(ptr) A(x,y); |
|
Standard C++ allocation operator for single objects. Implementation of the (default) C++ allocation operator for single objects (operator new). Definition at line 192 of file salloc.h. References LMalloc(). |
|
Standard C++ allocation operator for arrays. Implementation of the (default) C++ allocation operator for arrays (operator new[]).
Definition at line 247 of file salloc.h. References LMalloc(). |
|
Re-allocate array of PODs. Standard allocation and deallocation routines. NEVER USE malloc()/realloc()/free() directly. Resize memory area as returned by ALLOC
Definition at line 182 of file salloc.h. References LRealloc(). Referenced by TLString::SData::_DoTightenSize(), TLString::SData::_EnsureSize(), VM::InstructionStorage::_ReallocStore(), TLString::SData::DownSizeIfNeeded(), MYOP< T >::realloc(), TLDefaultOperators_Allocation::realloc(), NUM::RandomNumberGenerator_LibCRandom::seed(), and VM::InstructionStorage::TightenSize(). |