Functions


Accessing Heap Zones

ApplicationZone Returns a pointer to the original application heap zone.
GetZone Returns a pointer to the current heap zone.
HandleZone Returns a pointer to the heap zone containing a specified handle.
PtrZone Returns a pointer to the heap zone containing a specified pointer.
SetZone Changes the current heap zone.
SystemZone Returns a pointer to the system heap zone.

Allocating Temporary Memory

TempFreeMem Returns the total amount of memory available for temporary allocation.
TempMaxMem Compacts the current heap zone and returns the size of the largest contiguous block available for temporary allocation.
TempNewHandle Allocates a new relocatable block of temporary memory.

Allocating and Releasing Nonrelocatable Blocks of Memory

DisposePtr Releases memory occupied by a nonrelocatable block.
NewPtr Allocates a nonrelocatable block of memory of a specified size.
NewPtrClear Allocates a nonrelocatable block of memory of a specified size with all its bytes set to 0.
NewPtrSys Allocates a nonrelocatable block of memory of a specified size in the system heap.
NewPtrSysClear Allocates a nonrelocatable block of a specified size in the system heap with all its bytes set to 0.

Allocating and Releasing Relocatable Blocks of Memory

DisposeHandle Releases memory occupied by a relocatable block.
NewEmptyHandle Initializes a new handle without allocating any memory for it to control.
NewEmptyHandleSys Initializes a new handle in the system heap without allocating any memory for it to control.
NewHandle Allocates a new relocatable memory block of a specified size in the current heap zone.
NewHandleClear Allocates a relocatable block of memory of a specified size with all its bytes set to 0.
NewHandleSys Allocates a new relocatable block of memory of a specified size in the system heap zone.
NewHandleSysClear Allocates a relocatable block of memory of a specified size in the system heap with all its bytes set to 0.

Assessing Memory Conditions

FreeMem Returns the total amount of free space in the current heap zone.
FreeMemSys Returns the total amount of free space in the system heap zone.
MaxBlock Returns the size of the largest block you could allocate in the current heap zone after a compaction.
MaxBlockSys Returns the size of the largest block you could allocate in the system heap zone after a compaction.
MemError Determines if an application’s last direct call to a Memory Manager function executed successfully.
PurgeSpace Determines the total amount of free memory and the size of the largest allocatable block in the current heap zone if it were purged.
StackSpace Returns the amount of space between the bottom of the stack and the top of the application heap.

Changing the Sizes of Relocatable and Nonrelocatable Blocks

GetHandleSize Returns the logical size of the relocatable block corresponding to a handle.
GetPtrSize Returns the logical size of the nonrelocatable block corresponding to a pointer.
SetHandleSize Changes the logical size of the relocatable block corresponding to the specified handle.
SetPtrSize Changes the logical size of the nonrelocatable block corresponding to a pointer.

Freeing Memory

CompactMem Compacts the current heap zone.
CompactMemSys Compacts the system heap zone.
MaxMem Compacts and purges the current heap zone.
MaxMemSys Purges and compacts the system heap zone.
PurgeMem Purges the current heap zone.
PurgeMemSys Purges the system heap.

Grow-Zone Operations

GZSaveHnd Returns a relocatable block to be protected during grow-zone operations.
SetGrowZone Specifies the current heap zone’s grow-zone function.

Implementing a Virtual Memory Debugger

DebuggerEnter Allows the _DebugUtil trap to make preparations for subsequent debugging calls.
DebuggerExit Allows the _DebugUtil trap to clean up after all debugging calls are completed.
DebuggerGetMax Determines which debugger functions are present.
DebuggerLockMemory Makes a portion of the address space immovable in physical memory and ineligible for paging while leaving data caching enabled on the affected pages.
DebuggerPoll Polls for keyboard input.
DebuggerUnlockMemory Undoes the effect of DebuggerLockMemory. Makes a portion of the address space movable in real memory and eligible for paging again.
GetPageState Obtains the state of a page of logical memory.
PageFaultFatal Returns TRUE if the debugger should not allow the virtual memory’s bus-error handler to detect any page faults.

Managing Relocatable Blocks

EmptyHandle Purges a relocatable block and sets the corresponding handle’s master pointer to NULL.
HLockHi Moves a relocatable block to the top of the heap and locks the block.
MoveHHi Moves a relocatable block upward in the heap to help prevent heap fragmentation.
ReallocateHandle Allocates a new relocatable block of a specified size and sets a handle’s master pointer to point to the new block.
RecoverHandle Returns a handle to a relocatable block pointed to by a specified pointer.
ReserveMem Allocates a relocatable block of memory as close to the bottom of the heap as possible.
ReserveMemSys Allocates a relocatable block of memory as close to the bottom of the system heap zone as possible.

Managing Virtual Memory

DeferUserFn Determines whether code that might cause page faults can safely be called immediately.
GetPhysical Translates logical addresses into their corresponding physical addresses.
HoldMemory Makes a portion of the address space resident in physical memory and ineligible for paging.
LockMemory Makes a portion of the address space immovable in physical memory and ineligible for paging.
LockMemoryContiguous Makes a portion of the address space immovable in physical memory and ineligible for paging.
UnholdMemory Makes a currently held range of memory eligible for paging again.
UnlockMemory Undoes the effects of either LockMemory or LockMemoryContiguous.

Manipulating Blocks of Memory

BlockMove Copies a sequence of bytes from one location in memory to another.
HandAndHand Concatenates two relocatable blocks.
HandToHand Copies all of the data from one relocatable block to a new relocatable block.
PtrAndHand Concatenates part or all of a memory block to the end of a relocatable block.
PtrToHand Copies data referenced by a pointer to a new relocatable block.
PtrToXHand Copies data referenced by a pointer to an existing relocatable block.

Manipulating Heap Zones

GetApplLimit Returns a pointer to the current application heap limit.
InitApplZone Initializes the application heap zone and makes it the current zone.
InitZone Creates a new heap zone, initializes its header and trailer, and makes it the current zone.
SetApplBase Sets the starting address for an application’s heap zone.
SetApplLimit Sets the application heap limit.
TopMem Returns a pointer to the top of an application’s partition.

Manipulating Memory Addresses

StripAddress Strips the flag bits from a 24-bit memory address.
Translate24To32 Maps a 24-bit address into the 32-bit address space and returns it.

Setting Up the Application Heap

MaxApplZone Expands the application heap zone to its maximum.
MoreMasters Allocates a block of master pointers in the current heap zone.

Setting the Properties of Relocatable Blocks

HClrRBit Clears the resource flag of a relocatable block.
HGetState Returns a signed byte representing the current properties of a relocatable block.
HLock Prevents a relocatable block from moving within its heap zone.
HNoPurge Marks a relocatable block as unpurgeable.
HPurge Marks a relocatable block as purgeable.
HSetRBit Sets the resource flag of a relocatable block.
HSetState Restores the properties of a relocatable block.
HUnlock Allows a relocatable block to move in its heap zone.

Miscellaneous

BlockMoveData
BlockMoveDataUncached
BlockMoveUncached
BlockZero
BlockZeroUncached
CallGrowZoneProc
CallPurgeProc
CallUserFnProc
CheckAllHeaps
DisposeGrowZoneUPP
DisposePurgeUPP
DisposeUserFnUPP
EnterSupervisorMode
FlushMemory
GetGrowZone
GetVolumeVirtualMemoryInfo
InlineGetHandleSize
InvokeGrowZoneUPP
InvokePurgeUPP
InvokeUserFnUPP
IsHandleValid
IsHeapValid
IsPointerValid
LockMemoryForOutput
MakeMemoryNonResident
MakeMemoryResident
MoreMasterPointers Allocates a specified number of master pointers.
NewGrowZoneUPP
NewPurgeUPP
NewUserFnUPP
PurgeSpaceContiguous
PurgeSpaceSysContiguous
PurgeSpaceSysTotal
PurgeSpaceTotal
ReallocateHandleSys
RecoverHandleSys
ReleaseMemoryData
TempDisposeHandle
TempHLock
TempHUnlock
TempTopMem

© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)