Important: The information in this document is obsolete and should not be used for new development.
FreeMem
By calling theFreeMem
function, you can find out the total amount of free space, in bytes, in the current heap zone.
FUNCTION FreeMem: LongInt;DESCRIPTION
TheFreeMem
function returns the total amount of free space (in bytes) in the current heap zone. Note that it usually isn't possible to allocate a block of that size, because
of heap fragmentation due to nonrelocatable or locked blocks.SPECIAL CONSIDERATIONS
Even thoughFreeMem
does not move or purge memory, you should not call it at interrupt time because the heap might be in an inconsistent state.ASSEMBLY-LANGUAGE INFORMATION
The registers on exit forFreeMem
are
Registers on exit D0 Number of bytes available in heap zone The
FreeMem
function reports the number of free bytes in the current heap zone. If you want to know how many bytes are available in the system heap zone rather than in 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:
_FreeMem ,SYSRESULT CODES
noErr 0 No error