Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines / Managing Relocatable Blocks


EmptyHandle

The EmptyHandle procedure allows you to free memory taken by a relocatable block without freeing the relocatable block's master pointer for other uses.

PROCEDURE EmptyHandle (h: Handle);
h
A handle to a relocatable block.
DESCRIPTION
The EmptyHandle procedure purges the relocatable block whose handle is h and sets the handle's master pointer to NIL. The block whose handle is h must be unlocked but need not be purgeable.

Note
If there are multiple handles to the relocatable block, then calling
the EmptyHandle procedure empties them all, because all of the handles share a common master pointer. When you later use ReallocateHandle to reallocate space for the block, the master pointer is updated, and all of the handles reference the new block correctly.
SPECIAL CONSIDERATIONS
Because EmptyHandle purges memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for EmptyHandle are
Registers on entry
A0Handle to relocatable block
Registers on exit
A0Handle to relocatable block
D0Result code

RESULT CODES
noErr0No error
memWZErr-111Attempt to operate on a free block
memPurErr-112Attempt to purge a locked block
SEE ALSO
To purge all of the blocks in a heap zone that are marked purgeable, use the PurgeMem procedure, described on page 2-73.

To free the memory taken up by a relocatable block and release the block's master pointer for other uses, use the DisposeHandle procedure, described on page 2-34.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996