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 / Allocating and Releasing Relocatable Blocks of Memory


NewEmptyHandle

If you want to initialize a handle but not allocate any space for it, use the NewEmptyHandle function. The Resource Manager uses this function extensively,
but you probably won't need to use it.

FUNCTION NewEmptyHandle: Handle;
DESCRIPTION
The NewEmptyHandle function initializes a new handle by allocating a master pointer for it, but it does not allocate any memory for the handle to control. NewEmptyHandle sets the handle's master pointer to NIL.

SPECIAL CONSIDERATIONS
Because NewEmptyHandle might need to call the MoreMasters procedure to
allocate new master pointers, it might allocate memory. Thus, you should not call NewEmptyHandle at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The registers on exit for NewEmptyHandle are
Registers on exit
A0Address of the new block's master pointer
D0Result code

You can specify that the NewEmptyHandle function apply to the system heap zone instead of the current zone. To do so, set bit 10 of the routine trap word. In most development systems, you can do this by supplying the word SYS as the second argument to the routine macro, as follows:

_NewEmptyHandle ,SYS
RESULT CODES
noErr0No error
memFullErr-108Not enough memory
SEE ALSO
When you want to allocate memory for the empty handle, use the ReallocateHandle procedure, described on page 2-52.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996