Block Memory Managment
Divider

Class Memory Manager

The Memory Manager class represents a heap, with which an application can dynamically allocate, resize, and deallocate blocks of memory. The class cannot be instantiated; it is an abstract class from which specific types of memory managers are derived.

Function Allocate (Size: Integer): @;

Allocates a block of memory and returns the address. If the memory allocation fails, an EAllocFailure or derivative exception is thrown. Whether the memory allocated is initialized in any way is determined by the derived class.

Function Free (Data: @);

Frees the specified block of memory. If @Data is Null, or if @Data does not point to a memory block returned by Alloc of the same memory manager object, the behaviour is undefined. Free may check that @Data is not Null with an assertion.

Function ReAllocate (Data: @; Size: Integer): @

Resizes the specified block of memory. The address of the memory may have to change to accomodate a change in size; in this case, the new address is returned; otherwise, the old address is returned. If the address changes, ReAllocate will copy into the new block that portion of the existing block that fits into the new size.

Function GetBlockSize (Data: @): UInt32;

Determines and returns the size of the block referred to by Data.

Function GetMaxBlockSize (): Integer;

Returns the maximum size of a block allocated with this memory manager. The value returned is not the maximum block size that the manager can currently allocate; rather, it is the maximum block size the memory manager can theoretically handle.

Class Main Memory Manager

This class represents the system's primary memory management system. A global object MemMan is of this class.

Class Mini Memory Manager

This class is particularly designed to manage fairly small blocks of memory. On any given implementation, it cannot be guaranteed that blocks over 64KB can be allocated with this memory manager. Blocks made with this memory manager generally have less size overhead than those made with the Main Memory Manager. A global object MiniMemMan is of this class.

Table of Contents Qwertie's Site/Mirror
Next
Previous
Hosted by www.Geocities.ws

1