|
Public Types |
| typedef void * | aligned_t |
Public Member Functions |
| Standard_EXPORT | NCollection_IncAllocator (const size_t theBlockSize=24600) |
| | Constructor.
|
| virtual Standard_EXPORT void * | Allocate (const size_t size) |
| | Allocate memory with given size. Returns NULL on failure.
|
| virtual Standard_EXPORT void | Free (void *anAddress) |
| | Free a previously allocated memory. Does nothing.
|
| Standard_EXPORT size_t | GetMemSize () const |
| | Diagnostic method, returns the number of bytes totally allocated.
|
| Standard_EXPORT | ~NCollection_IncAllocator () |
| | Destructor (calls Clean() internally).
|
| Standard_EXPORT void * | Reallocate (void *anAddress, const size_t oldSize, const size_t newSize) |
| | Reallocation: it is always allowed but is only efficient with the last allocated item.
|
| Standard_EXPORT void | Reset (const Standard_Boolean doReleaseMem=Standard_True) |
| | Re-initialize the allocator so that the next Allocate call should start allocating in the very begining as though the allocator is just constructed. Warning: make sure that all previously allocated data are no more used in your code! doReleaseMem True - release all previously allocated memory, False - preserve it for future allocations.
|
Protected Member Functions |
| Standard_EXPORT void | Clean () |
| | Flush all previously allocated data. All pointers returned by Allocate() become invalid -- be very careful with this.
|
| void * | allocateNewBlock (const size_t cSize) |
| | Allocate a new block and return a pointer to it ** only for internal usage **.
|
Protected Attributes |
| IBlock * | myFirstBlock |
| size_t | mySize |
Private Member Functions |
| | NCollection_IncAllocator (const NCollection_IncAllocator &) |
| NCollection_IncAllocator & | operator= (const NCollection_IncAllocator &) |
Data Structures |
| struct | IBlock |
By comparison with the standard new() and malloc() calls, this method is faster and consumes very small additional memory to maintain the heap.