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 / Assessing Memory Conditions


PurgeSpace

Use the PurgeSpace procedure to determine the total amount of free memory and the size of the largest allocatable block after a purge of the heap.

PROCEDURE PurgeSpace (VAR total: LongInt; VAR contig: LongInt);
total
On exit, the total amount of free memory in the current heap zone if it were purged.
contig
On exit, the size of the largest contiguous block of free memory in the current heap zone if it were purged.
DESCRIPTION
The PurgeSpace procedure returns, in the total parameter, the total amount of space (in bytes) that could be obtained after a general purge of the current heap zone; this amount includes space that is already free. In the contig parameter, PurgeSpace returns the size of the largest allocatable block in the current heap zone that could be obtained after a purge of the zone.

The PurgeSpace procedure does not actually purge the current heap zone.

ASSEMBLY-LANGUAGE INFORMATION
The registers on exit for PurgeSpace are
Registers on exit
A0Maximum number of contiguous bytes after purge
D0Total free memory after purge

If you want to test the system heap zone instead of the current 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:

_PurgeSpace ,SYS
RESULT CODES
noErr 0No error

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996