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 / Freeing Memory


MaxMem

Use the MaxMem function to compact and purge the current heap zone.

FUNCTION MaxMem (VAR grow: Size): Size;
grow
On exit, the maximum number of bytes by which the current heap zone can grow. After a call to MaxApplZone, MaxMem always returns 0 in this parameter.
DESCRIPTION
The MaxMem function compacts the current heap zone and purges all relocatable, unlocked, and purgeable blocks from the zone. It returns the size, in bytes, of the largest contiguous free block in the zone after the compacting and purging. If the current zone is the original application zone, the grow parameter is set to the maximum number of bytes by which the zone can grow. For any other heap zone, grow is set to 0. MaxMem doesn't actually expand the zone or call the zone's grow-zone function.

SPECIAL CONSIDERATIONS
Because MaxMem moves and purges memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The registers on exit for MaxMem are
Registers on exit
A0Number of bytes zone can grow
D0Size in bytes of largest allocatable block

The MaxMem function compacts the current heap zone. If you want to compact and purge the system heap zone rather than the current heap zone, 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:

_MaxMem ,SYS
RESULT CODES
noErr0No error

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996