Class: TLocalMemoryHeap

Declaration: StandardMemoryHeap.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TStandardMemoryHeap

Inherited By:

None.

Purpose:

TLocalMemoryHeap is a class that provides a standard heap implementation for use within a single address space.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive any classes from TLocalMemoryHeap.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TLocalMemoryHeap::TLocalMemoryHeap

  1. TLocalMemoryHeap (size_t maxBytes =0)
  2. TLocalMemoryHeap (const TLocalMemoryHeap &)

Interface Category:

API.

Purpose:

  1. Constructs a local heap of the specified size.
  2. Copy constructor.

Calling Context:

  1. Called to construct a local heap of the specified size.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

A local heap can eventually grow larger than its initial size.

Member Function: TLocalMemoryHeap::~TLocalMemoryHeap

virtual ~ TLocalMemoryHeap ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

The Heap framework makes one distinguished instance the master object, so deleting a nonmaster object does not delete the heap itself.

Member Function: TLocalMemoryHeap::operator=

TLocalMemoryHeap & operator =(const TLocalMemoryHeap &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TLocalMemoryHeap::operatornew

  1. void * operator new (size_t size, char * where)
  2. void * operator new (size_t size)
  3. void * operator new (size_t size, TMemoryHeap & whichHeap)
  4. void * operator new (size_t size, const TAllocationHeap & whichHeap)

Interface Category:

API.

Purpose:

  1. Allocates a TLocalMemoryHeap, specifying the storage location.
  2. Allocates a TLocalMemoryHeap into the default heap.
  3. Allocates a TLocalMemoryHeap into the specified heap.
  4. Allocates a TLocalMemoryHeap into the specified allocation heap.

Calling Context:

  1. Called only by the loader.
  2. Called by clients of TLocalMemoryHeap.
  3. Called by clients of TLocalMemoryHeap.
  4. Called by clients of TLocalMemoryHeap.

Parameters:

Return Value:

Returns a pointer to the block.

Exceptions:

Throws no exceptions, passes through exceptions from the various forms of ::operator new.

Concurrency:

Multithread safe.

Other Considerations:

The first form of the new operator is provided to allow the loader bootstrap code to create a TLocalMemoryHeap in static storage. If a class provides operator new, all global operator new overloads and operator delete must also be provided to allow clients to allocate objects of that class in a heap. Because TLocalMemoryHeap provides a special operator new for the loader, it must also provide the same overloads as the global operator new to allow clients to allocate TLocalMemoryHeaps in heaps.

Member Function: TLocalMemoryHeap::operatordelete

void operator delete (void * block)

Interface Category:

API.

Purpose:

Deletes a TLocalMemoryHeap.

Calling Context:

Called by TLocalMemoryHeap client to delete a TLocalMemoryHeap.

Parameters:

Return Value:

None.

Exceptions:

Passes through exceptions from the global operator delete.

Concurrency:

Multithread safe.

Other Considerations:

Because TLocalMemoryHeap overloads operator new, the delete operator is required to allow clients to delete heap-allocated TLocalMemoryHeap objects.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.