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 / Manipulating Heap Zones


InitZone

If you want to use heap zones other than the original application heap zone, a temporary memory zone, or the system heap zone, you can use the InitZone procedure to initialize a new heap zone.

PROCEDURE InitZone (pGrowZone: ProcPtr; cMoreMasters: Integer; 
                     limitPtr, startPtr: Ptr);
pGrowZone
A pointer to a grow-zone function for the new heap zone. If you do not want the new zone to have a grow-zone function, set this parameter
to NIL.
cMoreMasters
The number of master pointers that should be allocated at a time for the new zone. The Memory Manager allocates this number initially, and, if it needs to allocate more later, allocates them in increments of this same number.
limitPtr
The first byte beyond the end of the zone.
startPtr
The first byte of the new zone.
DESCRIPTION
The InitZone procedure creates a new heap zone, initializes its header and trailer, and makes it the current zone. Although the new zone occupies memory addresses from startPtr through limitPtr-1, the new zone includes a zone header and a zone trailer. In addition, the new zone contains a block header for the master pointer block and 4 bytes for each master pointer. If you need to create a zone with some specific number of usable bytes, see "Organization of Memory," beginning on page 2-19, for details on the sizes of the zone header, zone trailer, and block header.

Note
The sizes of zones and block headers may change in future system software versions. You should ensure that your zones are large enough to accommodate a reasonable increase in the sizes of those structures.
SPECIAL CONSIDERATIONS
Because InitZone changes the current zone, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit for InitZone are
Registers on entry
A0Pointer to parameter block
Registers on exit
D0Result code

The parameter block whose address is passed in register A0 has no Pascal type definition. It has this structure:

-->startPtrPtrThe first byte of the new zone.
-->limitPtrPtrThe first byte beyond the new zone.
-->cMoreMastersIntegerThe number of master pointers to be allocated at a time.
-->pGrowZoneProcPtrA pointer to the new zone's grow-zone function, or NIL if none.

RESULT CODES
noErr0No error

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996