SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND


Platform
Template Class Allocator

NonConstructibleType
   |
   +-Allocator

Implemented in:
Platform.Allocator.h

template <typename Type>
class Allocator:
private NonConstructibleType

Memory allocator.

Method Summarycollapse
static Type* allocate(Int elements = 1)
          Allocates memory.
static Type* allocateAndZero(Int elements = 1)
          Allocates memory and initializes the contents to zero.
static Void deallocate(Type* handle, Int elements = 1)
          Deallocates memory.
static Int isAllocateNeeded(Int oldElements, Int newElements)
          Tests whether an allocation may be necessary given the old and the new space requirements.

 

Method Detail

allocate[nothrow, inline]

static Type* allocate(Int elements = 1)

Allocates memory.

Parameters:
elements - the number of elements to allocate
Returns:
pointer to the allocated space, used as a handle during deallocation

allocateAndZero[nothrow, inline]

static Type* allocateAndZero(Int elements = 1)

Allocates memory and initializes the contents to zero.

Parameters:
elements - the number of elements to allocate
Returns:
pointer to the allocated space, used as a handle during deallocation

deallocate[nothrow, inline]

static Void deallocate(Type* handle, Int elements = 1)

Deallocates memory.

Parameters:
handle - a handle
elements - the number of elements previously allocated

isAllocateNeeded[nothrow, inline]

static Int isAllocateNeeded(Int oldElements, Int newElements)

Tests whether an allocation may be necessary given the old and the new space requirements.

An allocator implementation may allocate space in pre-partitioned blocks of fixed size. If an already allocated block has excess of space (e.g. application requested 4 bytes but memory block granularity is 16 bytes) this method can prove whether the previously allocated memory block can be reused given the old and new space requirements.

Parameters:
oldElements - the old number of elements
newElements - the new number of elements
Returns:
Non-zero if new memory block must be allocated given the new space requirements, 0 otherwise


SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND