Important: The information in this document is obsolete and should not be used for new development.
MaxMem
Use theMaxMem
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
TheMaxMem
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, thegrow
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
BecauseMaxMem
moves and purges memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The registers on exit forMaxMem
are
Registers on exit A0 Number of bytes zone can grow D0 Size 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 wordSYS
as the second argument to the routine macro, as follows:
_MaxMem ,SYSRESULT CODES
noErr 0 No error