Important: The information in this document is obsolete and should not be used for new development.
FreeMem
By calling theFreeMemfunction, you can find out the total amount of free space, in bytes, in the current heap zone.
FUNCTION FreeMem: LongInt;DESCRIPTION
TheFreeMemfunction 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 thoughFreeMemdoes 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 forFreeMemare
Registers on exit D0 Number of bytes available in heap zone The
FreeMemfunction 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 wordSYSas the second argument to the routine macro,
as follows:
_FreeMem ,SYSRESULT CODES
noErr 0 No error